使用msal验证'management.azure.com'

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

我正在尝试使用MSAL with angular查询用户可用的租户列表。我以前曾成功使用adal.js

这是请求URL:https://management.azure.com/tenants?api-version=2019-11-01MSAL成功将承载令牌注入到请求中。但是,我在www-authenticate中看到以下错误:

www-authenticate:承载授权_uri =“ https://login.windows.net/”,error =“ invalid_token”,error_description =“找不到访问令牌的身份。”

我对此错误有点困惑-login.windows.net似乎已弃用的身份验证流程的一部分。

我在protectedResourceMap中有'https://management.azure.com/', ['user_impersonation']。我尝试将权限设置为https://login.microsoftonline.com/{tenantId}以及默认设置。尚未从ADAL更改clientId,承租人等。

知道这个怎么了吗?

adal msal
1个回答
0
投票

对于adal(v1.0端点),我们需要使用resource: https://management.azure.com。授权网址为https://login.microsoftonline.com/{tenant}/oauth2/authorize

对于msal(v2.0 endpint),我们需要使用scope:https://management.azure.com/user_impersonation。授权网址为https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize

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