Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get ID token claims for existing sessions #1905

Closed
1 of 5 tasks
deasems opened this issue Jul 7, 2020 · 2 comments
Closed
1 of 5 tasks

How to get ID token claims for existing sessions #1905

deasems opened this issue Jul 7, 2020 · 2 comments
Assignees
Labels
msal-browser Related to msal-browser package question Customer is asking for a clarification, use case or information.

Comments

@deasems
Copy link

deasems commented Jul 7, 2020

Library

  • msal@1.x.x or @azure/msal@1.x.x
  • @azure/msal-browser@2.0.0-beta.4
  • @azure/msal-angular@0.x.x
  • @azure/msal-angular@1.x.x
  • @azure/msal-angularjs@1.x.x

Description

I'm updating my POC app from beta.2 to beta.4. It looks like the account object that is persisted for a session is much more limited than before and doesn't include the id token claims. My app needs access to the id token claims so this change impacts my app initialization - if I'm getting a fresh session from the server I'll get the id token claims and proceed as usual, but, if I'm initializing with an existing session I don't have access to this data now so my question is - what is the recommended way to get id token claims for an existing session?

Currently I'm working around this by getting the id token data from a subsequent access token request but I'd prefer a solution that's not coupled to other operations. From a performance perspective I'd actually prefer if the claims could be returned from a cache so that we don't incur a new delay to fetch id tokens when we're initializing an existing session.

@deasems deasems added the question Customer is asking for a clarification, use case or information. label Jul 7, 2020
@jo-arroyo jo-arroyo added the msal-browser Related to msal-browser package label Jul 7, 2020
@jo-arroyo jo-arroyo self-assigned this Jul 7, 2020
@pkanher617
Copy link
Contributor

@deasems You can do this by calling acquireTokenSilent() with openid and profile as the scopes and passing the account object. This will retrieve the relevant token from the cache and contain the idTokenClaims in the response.

@deasems
Copy link
Author

deasems commented Jul 7, 2020

Thanks @pkanher617, I tried this out and it worked well 👍

@deasems deasems closed this as completed Jul 7, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
msal-browser Related to msal-browser package question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

3 participants