Search code examples
node.jssurrealdb

How do I get a user object from a jwt token in surrealdb?


I have a jwt token returned by surrealdb's signin() method.

How do I populate a user object on authenticated requests using this token?


Solution

  • You can't get user data from the token but you should use the user's provided details to create a Userobject. You will need to store the token in a session store or on the client side to send it in the future requests.