Description
Core Library
No response
Wrapper Library
Not Applicable
Public or Confidential Client?
Confidential
Documentation Location
Description
So I asked about SSR here and got recommended to look at the hybrid spa flow for a full stack app.
I also found this issue where the question is about how do use the msla libraries in a system with frontend and backend where the recommendation was to look at the hybrid spa flow aswell.
However, It is my understanding that the hybrid spa flow as described in the sample does not answer that question. It is my understanding that at the end of the SPA flow in the documented example both frontend and backend have a valid access token and refresh token each. However the access token in the frontend has the audience graph as the scope is "user.read".
I also found this longer issue that touches this topic.
One quoute from there is:
Access tokens should only be handled by the Identity Provider, the application that requested them and the resource they are intended for. Passing them back and forth between frontend and backend is not recommended despite what others have decided to do.
To me that means I am not supposed to send the access token from the hybrid spa flow sample to the backend.
To get a valid token for the backend my assumtion is that I have to expose the web API as described here. As statet here this would be possible with one app regestration but it might make sense to use two.
But is that compatible with the hybrid spa flow. My assumption is that is is not because of this quote in the longer issue from above:
If both the backend and frontend share an appId you can use the "Hybrid SPA flow" to show a single interactive prompt on the backend to acquire your backend tokens then redeem the "spa code" on your frontend to acquire your frontend tokens.
Since the backend already has a valid token for the user with graph claims I suspect that this is not a use case for the obo flow?
What is the recommended way to make a request to the backend that might use the graph API or specific user data from the application database?