hitochan
hitochan

Reputation: 1068

Firebase authentication: how to create session cookie with additional info?

I use createSessionCookie in firebase authentication to create a session cookie using id token obtained after successfully logging in with Google account. Is it possible to include additional information such as username or email in the cookie generated by createSessionCookie?

I am wondering if I could use createCustomtoken, but according to the docs users need to sign in with signInWithCustomToken. In this case I am not sure if users can be authenticated with Google provider.

Upvotes: 2

Views: 3503

Answers (1)

bojeil
bojeil

Reputation: 30808

No you can't. The created session cookie will have the same claims as the original ID token you used to mint the session cookie from. If you want to add additional custom claims to that user so they can be propagated to the session cookie, you will first have to set them via custom user attributes on the user, before minting the session cookie.

Upvotes: 1

Related Questions