[英]How to configure msal-angular interceptor to send an access token (v2) to own domain (self)
我從 v1 更新到 @azure/msal-angular v2。 而且我無法弄清楚如何配置它以將訪問令牌發送到托管在同一域上的后端。
因此,當我的前端向/api/foo
發出請求時, MsalInterceptor
應以版本 2 格式附加我的訪問令牌 - 而不是版本 1。
這使它發送版本 1 訪問令牌
const msalInterceptorConfig: MsalInterceptorConfiguration = {
interactionType: InteractionType.Redirect,
protectedResourceMap: new Map([
['/', ['openid']],
]),
};
我設法通過添加來“欺騙”它
const msalInterceptorConfig: MsalInterceptorConfiguration = {
interactionType: InteractionType.Redirect,
protectedResourceMap: new Map([
['/', [`api://${clientId}/access_as_user`]],
]),
};
但隨后 AzureAD 開始抱怨
AADSTS90009:應用程序正在為自己請求令牌。 僅當使用基於 GUID 的應用程序標識符指定資源時才支持此方案
所以這不是一個選擇。 如何讓MsalInterceptor
向/
發送版本 2 訪問令牌?
我不知道這是否是正確的方式,甚至是預期的行為。 但是以下配置向我的后端發送了一個 v2 訪問令牌。
const msalInterceptorConfig: MsalInterceptorConfiguration = {
interactionType: InteractionType.Redirect,
protectedResourceMap: new Map([
['/', [`${clientId}/openid`]],
]),
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.