supertokens / supertokens-auth-react

ReactJS authentication module for SuperTokens

Home Page:https://supertokens.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty Session.getAccessTokenPayloadSecurely()

sayhicoelho opened this issue · comments

I'm trying to run this piece of code to get the authenticated user info but always returns an empty object.

image

Session.getUserId() is OK, but Session.getAccessToken() returns undefined.

My code:
image

My console.log:
image

Hey.

  • For the accessTokenPayload to have some values in it, you need to set it on the backend by overriding the createNewSession function
  • When using cookie based auth, the getAccessToken function returns undefined - cause the frontend JS doesn't have access to the access token (since it's httpOnly cookie).

These don't seem to be issues with our SDKs, so closing this issue for now.