首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AADSTS700016:使用MSAL对Azure进行身份验证时未能获得访问令牌

AADSTS700016:使用MSAL对Azure进行身份验证时未能获得访问令牌
EN

Stack Overflow用户
提问于 2021-04-13 10:35:53
回答 1查看 1.1K关注 0票数 2

我想使用MSAL对Azure进行身份验证,我将其指定如下:

代码语言:javascript
复制
 app = msal.ConfidentialClientApplication(
        client_id=client_id,
        client_credential=client_secret,
        authority='https://login.microsoftonline.com/' + tenantname
    )
    result = app.acquire_token_for_client(scopes=scopes)

它失败了,因为它找不到我可以访问的公司的租户名称,即使它是正确指定的。

Error description was: AADSTS700016: Application with identifier '12341234123somethingtest-fje2434823412341234123somethingtest-4322134-213413212341234123somethingtest' was not found in the directory '213412312341234123somethingtest-1234-3241'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant. Exception: Failed to obtain access token

我也尝试过来自AAD的租户名称和租户ID,并且总是得到相同的错误。有没有办法解决这个问题?(当我在自己的Azure上使用代码时,代码工作得很好。)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-04-13 12:29:11

你的错误已经解决了。这是由于您的client_id中缺少字符造成的。只需输入正确的client_id即可。

遇到类似的问题,可以在浏览器中运行管理员同意url调试:

https://login.microsoftonline.com/{tenant-id}/adminconsent?client_id={client-id}

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67073218

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档