I’m trying to save a user session token after executing an Auth0 post-logon action and I am using customClaims to do so. The code essentially boils down to:
exports.onExecutePostLogin = async (event, api) => {
token = getTokenFromBackend()
token = token[“data”][“token”]
api.accessToken.setCustomClaim(${namespace}/session_token
, token);
};
Token retrieval is fine, but now I have an issue with retrieving the token. I am using the Auth0-spa sdk for this. I am running this on a localhost.
const auth0Client = new Auth0Client({
domain:
client_id: <client_id>
redirect_uri: “http://localhost:3000/”
});
Then I run:
const user = await auth0.getUser();
I don’t know why user is undefiend and auth0.isAuthenticated() is false. Would appreciate some help
Also, is my use of customClaims correct or is there a better way of doing things?