Blazor WASM Azure AD连接到Microsoft图形

问题描述 投票:0回答:1

我在Azure AD Connect中拥有强大的能力。我正在关注here中的文档。我可以登录并获得访问令牌。但是问题是当我尝试使用访问令牌从https://graph.microsoft.com调用API时,我无法使用它,并且错误显示为Access token validation failure. Invalid audience.。当我从https://jwt.ms调试时,aud充满了我的客户端ID,而不是MS Graph。我已经尝试过添加

builder.Services.AddMsalAuthentication(options =>
{
    builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication);
    options.ProviderOptions.DefaultAccessTokenScopes.Add("https://graph.microsoft.com/.default");
}

在客户端项目中,但仍无法使用令牌访问MS Graph。我还需要添加吗?

azure-active-directory microsoft-graph blazor msal blazor-client-side
1个回答
0
投票

Cookie和站点数据可能会在应用程序更新中持续存在,并干扰测试和故障排除。

您为https://graph.microsoft.com/.default使用了正确的值DefaultAccessTokenScopes。但这似乎没有生效。

请参阅Troubleshoot,以避免缓存的影响。

© www.soinside.com 2019 - 2024. All rights reserved.