oferitz
oferitz12mo ago

Using JWT in actions

@Tom Isn't getToken() only available on client side?
3 Replies
ballingt
ballingt12mo ago
Yes, you'd have to pass this in as an argument to the action, or if the client runs a mutation to schedule the action, to this mutation.
oferitz
oferitzOP12mo ago
Thanks. I figured so. Can I suggest exposing the JWT token on the auth object as a feature request? This way, I can avoid carrying it from the client to the backend, as Convex is already aware of the token in the function/action context.
ballingt
ballingt12mo ago
That makes sense, some kind of ctx.getUserIdentityToken() in addition to ctx.getUserIdentity(). Adding a tally mark to requests for this! Sometimes this token is different than the one you'd need for another service, e.g. the aud: field must be "convex." But if this token does work for something else makes sense it would be simpler not to pass it as an argument.

Did you find this page helpful?