C
C#8mo ago
cisflex

getting acces token inside mvc

I have a API that uses azure identity authentication and authorization for the endpoints. I also have a mvc that is using the same azure application reg for authentication and authorization. The authentication and authorization work on both part but when I wane make an api call from my mvc to the api on protected endpoint I am keep getting a 401. Can someone help how I can get the correct acceestoken inside my mvc tot data from my api
1 Reply
Joschi
Joschi8mo ago
I don't think sharing access tokens is best practice and I believe the tokens may also not be exchangeable depending on your configuration. What you probably wanna do is setting up the other API as a downstream API and request a new access token for that either on behalf of the user or the application. For that you either use the IDownstreamApi, or you get the token from the IAuthorizationHeaderProvider or ITokenAquisition.
Want results from more Discord servers?
Add your server