I have built a Node.js web app hosted on Azure with Azure AD authentication. How can I obtain the bearer token from the client's session to send authenticated requests to another app service in Azure also protected by the same Azure AD?
我使用Azure AD身份验证在Azure上构建了一个Node.js Web应用程序。如何从客户端会话中获取承载令牌,以将经过身份验证的请求发送到Azure中的另一个应用服务,该服务也受同一Azure AD的保护?
1 个解决方案
#1
2
When your user get authenticated via AAD and redirect to your web app hosted on Azure. Your can get the HTTP header of this request, you can find the access_token
is stored in the header param X-Ms-Token-Aad-Id-Token
.
当您的用户通过AAD进行身份验证并重定向到Azure上托管的Web应用程序时。您可以获取此请求的HTTP标头,您可以发现access_token存储在标头参数X-Ms-Token-Aad-Id-Token中。
Then you can store this token in session or in cookie for your custom requirement. And you set this token in the header of the request against to your other web apps in the same AAD.
然后,您可以将此令牌存储在会话或cookie中,以满足您的自定义要求。并且您在请求的标头中将此令牌设置为同一AAD中的其他Web应用程序。
The token should be set in the Authorization
param in headers and the value format should be bearer <token>
.
令牌应在头部的Authorization param中设置,值格式应为bearer
Any further concern, please feel free let me know.
任何进一步的关注,请随时让我知道。
#1
2
When your user get authenticated via AAD and redirect to your web app hosted on Azure. Your can get the HTTP header of this request, you can find the access_token
is stored in the header param X-Ms-Token-Aad-Id-Token
.
当您的用户通过AAD进行身份验证并重定向到Azure上托管的Web应用程序时。您可以获取此请求的HTTP标头,您可以发现access_token存储在标头参数X-Ms-Token-Aad-Id-Token中。
Then you can store this token in session or in cookie for your custom requirement. And you set this token in the header of the request against to your other web apps in the same AAD.
然后,您可以将此令牌存储在会话或cookie中,以满足您的自定义要求。并且您在请求的标头中将此令牌设置为同一AAD中的其他Web应用程序。
The token should be set in the Authorization
param in headers and the value format should be bearer <token>
.
令牌应在头部的Authorization param中设置,值格式应为bearer
Any further concern, please feel free let me know.
任何进一步的关注,请随时让我知道。