Obtain autorization code from `loginPopup` instead of token(s)
See original GitHub issueCore Library
MSAL.js v2 (@azure/msal-browser)
Wrapper Library
MSAL React (@azure/msal-react)
Public or Confidential Client?
Public
Description
loginPopup
sends a request to /oauth2/token
to obtain access_token
and id_token
immediately after obtaining authorization_code
in its implementation. But I want to obtain authorization_code
directly from my public client and redeem it for accesss_token
in our server.
Source
External (Customer)
Issue Analytics
- State:
- Created a year ago
- Comments:18 (5 by maintainers)
Top Results From Across the Web
ReAuthentication using PopUP(Auth Code Grant Flow)
Ideally in Authorization-Code Grant flow, you first call the /authorize endpoint to get authorization code and then you use that authorization ...
Read more >PublicClientApplication | microsoft-authentication-libraries-for-js
This function redeems an authorization code (passed as code) from the eSTS token endpoint. This authorization code should be acquired server-side using a ......
Read more >Using the Authorization Code Flow with PKCE in Azure AD ...
In this flow, access tokens were returned directly to the browser without ... HTTP GET https://AzureADURL/authorize &response_type=code ...
Read more >How to get an access token with Auth Code Grant | DocuSign
Note: Instead of generating the access token manually, you can also implement Authorization Code Grant authentication by: Using methods from one of the...
Read more >Auth0 Single Page App SDK
Auth0 SDK for single page applications using Authorization Code Grant Flow with ... Instead, you can opt-in to store tokens in local storage...
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 FreeTop 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
Top GitHub Comments
@okapies the problem is that you are requesting below an access token for Microsoft Graph, NOT for your own web API.
Instead, the scope should be your web API’s APP ID URI followed by the scope name you defined in your application.
If you look at the app registration steps in the sample I’ve shared, it instructs you to create a custom scope for your API, and then request permissions to it in your SPA.
So to summarize the misunderstanding here, every access token is meant for a certain resource/API and cannot be used for accessing other resources/APIs. You tell MSAL what resource/API you need an access token for via the
scopes
property in the request object that you pass toacquireToken*
method.@derisen Thanks for your kind advice. I’ll look into the on-behalf-of flow!