Azure Static Web App - Pass authentication info to your linked API
source link: https://bartwullems.blogspot.com/2024/03/azure-static-web-app-pass.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Azure Static Web App - Pass authentication info to your linked API
As a follow-up on the presentation I did at CloudBrew about Azure Static Web Apps I want to write a series of blog posts.
If you have read my post yesterday, you know that you can link an existing API exposed through Azure API Management, an Azure App Service or Azure Container Apps to your Azure Static Web App.
When using this feature, your API is secured through Azure Static Web App and uses the configured provider.
The question that remains is
How can your API access the authentication token from Azure Static Web App?
The answer is simple, the information is passed to your API through a specific header; the X-MS-CLIENT-PRINCIPAL header. This header contains the token Base64 encoded in the same JSON structure as when calling the .auth/me endpoint:
Let’s update our ACA API to read this header data:
If we now call our API through Azure Static Web App, we get the security token back:
Popular posts from this blog
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK