Retrieve access token from AAD B2C
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
**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 https://github.com/Azure/static-web-apps/issues/429#issuecomment-942805564.
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 define`response_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](https://docs.microsoft.com/en-us/azure/static-web-apps/authentication-authorization?tabs=function#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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.