RJR
Convex Community3y ago
19 replies
RJ

User impersonation with Clerk

I'm implementing user impersonation with Clerk (https://clerk.com/docs/custom-flows/user-impersonation), and appear to have succeed in creating an actor token through Clerk's API and authenticating with it.

My ostensible proof of this:

import { useAuth } from "@clerk/clerk-react";

// ...

const { actor } = useAuth(); // `actor` is present


My understanding, per https://clerk.com/docs/custom-flows/user-impersonation#jwt-claims, is when impersonating a user, the sub claim should contain the ID for the impersonated user, so Convex should by default in all regards treat the impersonator as the impersonated user. But my Convex functions still seem to be functioning as though the value of the sub claim is the impersonator.

Any clue why this might be happening? Anything I'm misunderstanding about how any of this works?
Was this page helpful?