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

Retrieve access token from AAD B2C #709

Open
jon-a-nygaard opened this issue Jan 31, 2022 · 4 comments
Open

Retrieve access token from AAD B2C #709

jon-a-nygaard opened this issue Jan 31, 2022 · 4 comments

Comments

@jon-a-nygaard
Copy link

Is your feature request related to a problem? Please describe.
I am using custom authentication with AAD B2C, and would like to retrieve the access token without using a second authentication request, and then use the token as authentication towards an API.

Describe the solution you'd like
I noticed a similar issue #591 where there's a request for supporting a hydbrid flow. It seems that the response type is hard coded, and if I was able to define the response type I imagine that I would be able to retrieve the access token in a GetRoles function as a workaround, similar to whats mentioned at #429 (comment).

Preferably it would be great if the access token was automatically added to API function request headers, similarly to a token store as mentioned in #483. Alternatively I would like the token to be set on the client principle as another way to access it.

Describe alternatives you've considered

  • I have tried to defineresponse_type in loginParameterNames to retrieve the access token, but with no luck as it appears it is hard coded.
  • I have tried to retrive the access token in a GetRoles function as described in Create a function for assigning roles, but it does not seem to be included in my case.
  • I have considered using MSAL to retrieve the access token, but it does not seem to be possible without a second authentication interaction for the user.

Currently it seems that my best approach is to use custom authentication with MSAL.js to handle this scenario.
Any possible solution or tips on workarounds is greatly appreciated.

@NivGreenstein
Copy link

Same here!

@NivGreenstein
Copy link

@anthonychu @simonaco @mkarmark @miwebst Can someone please address the issue?

@aldisv
Copy link

aldisv commented Oct 27, 2022

Same issue here.

React SPA App
B2C issuing client tokens
Calling APIs behind integrated API Management (with SWA/APIManagement integration)
Backend APIs need valid access tokens with client data for authorization and data access security (and end-to-end tracing)

@jon-a-nygaard , did you find a workaround or go custom MSAL based approach?

@NivGreenstein
Copy link

Same issue here.

React SPA App B2C issuing client tokens Calling APIs behind integrated API Management (with SWA/APIManagement integration) Backend APIs need valid access tokens with client data for authorization and data access security (and end-to-end tracing)

@jon-a-nygaard , did you find a workaround or go custom MSAL based approach?

We went with custom MSAL instead of the built in integration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants