my infrastructure is as follows:
- I have a back-end Web API that uses Azure B2C authentication (respectively via JWT tokens)
- I have a front-end app written on Next.js and it uses NextAuth.js to manage the authentication.
Everything seems ok - I can authenticate users in the front-end with the registered identity providers but... I need to call the back-end with an access token from Azure B2C so my requests are authenticated.
What is the correct way of managing this access token? I could not find any information about whether or not I should generate it by myself or there is some mechanism to simplify all this?
There is another question I would like to discuss - is NextAuth.js the correct library for my use case? I mean, there is more documentation and examples for @azure/msal-react
, it is specialized into this matter, so is it the better option?