SCP is missing in access token claims
See original GitHub issueUnable to get SCP=“access_as_user” in access token claims. I want an access token of OAuth v2.0 that returns SCP=“access_as_user” in the claims.
Library
-
@azure/msal-angular:^1.0.0-beta.2 -
msal:^1.2.2-beta.0
Description
I am trying to get SCP claim from the access token using msal-angular 1.0.0 beta version in my SPA application. Please refer below steps:
- Define MsalModule.forRoot({}), with all the information and consentScopes as ‘api://xxxxxxx-xxxxxxx-xxxxxxxx-xxxxxxxx/access_as_user’. (exposed in Azure portal for API app)
- Call this.authService.loginRedirect() method to get id_token.
- In the success callback of login redirect, I called below method to get access token this.authService.acquireTokenSilent(accessTokenRequest);
But ‘acquireTokenSilent’ doesn’t return OAuth 2.0 token rather it return either same id_token or v1.0 access token, which is not useful for me to get SCP in the claims
Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Requested Scope Not Present in Access Token scp Claim
The UI app is correctly requesting the API scope and the scope is present in the consent UI presented to the user.
Read more >Missing 'roles' or 'scp' claim in B2C token client credentials flow
If you want scp claims in the decoded access token, you need to Expose an API and grant API permission for it by...
Read more >Solved: Scp scope missing in JWT token
Hello Team, I am able to generate JWT token using API but while validatign found scp scope missing in token. Although I have...
Read more >OpenID Connect & OAuth 2.0 API - Okta Developer
The OAuth 2.0 protocol provides API security via scoped access tokens, ... Okta rejects the JWT if the jti claim is present and...
Read more >Azure AD and the Un-validatable Access Token - Punny Stuff
The funny looking aud claim indicates that the access token is actually intended to be presented to the Microsoft Graph API, not your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@vaibhav915 Your token depends on the scopes requested/permitted for your app and the authority that grants the token to those scopes.
access_as_userused to be a default scope provided by the app portal registration experience but the new UI requires one to explicitly add this as a supported scope now.From what I gather, the request above does not request this scope explicitly and hence you do not see it in the token. Can you please add it in the
scopespart of the request and verify? I tested this and it works in a sample app for me.Also we recommend not to open
access_tokensin your application as a good practice.@jasonnutter I was able to get the correct access token after login. On the broadcast call
msal:loginSuccess, I put in the following code below. I verified the token on jwt.ms and I am seeing thescp>access_as_userand was able to verify the token on the API.https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-protected-web-api-verification-scope-app-roles#verify-scopes-in-apis-called-on-behalf-of-users
CLIENT
I am now running into an issue with
VerifyUserHasAnyAcceptedScopenot finding thescpbut after dropping the method into my code and making some modifications, I was able to verify the scope. This is another issue I need to figure out 😄API