Where to store user id when registering for passkey?

So I am using stytch backend api’s for designing my auth flow. I wanted to know what would be the best approach to save user id in the frontend as it is needed during passkey authentication. Currently I’m saving it in localstorage.

Hey Madhav – thanks for posting!

The user_id is actually optional during passkey authentication, so you shouldn’t need to store it on the frontend! If the user is not yet authenticated, there is no need to pass in a user_id.

During passkey registration, you’ll want to use the user_id from the logged-in user’s active session.

Happy to help with any questions you have about this!