“error_description":“抛出了“Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException"类型的异常." [英] "error_description":"Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown."

查看:27
本文介绍了“error_description":“抛出了“Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException"类型的异常."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试使用 azure oauth2 安全地访问共享点 api.我们得到了持有者令牌,但是在访问 sharepoint rest api 时,我们得到了状态代码:401 未授权和响应:{"error_description":"抛出了类型 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' 的异常."}

we are trying to access a sharepoint api securely using azure oauth2. we got the bearer token but while accessing sharepoint rest api, we are getting Status code: 401 Unauthorized and Response: {"error_description":"Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown."}

  1. 我们已经在 azure AD 中注册了一个客户端应用程序一种.在身份验证中定义重定向 uri湾将访问角色映射到服务用户帐户C.定义的客户端密码d.已提供定义的 API 权限和管理员同意

令牌端点:https://login.microsoftonline.com/66395830-4e70-4a10-8f30-225fe9afd23b/oauth2/v2.0/token

方法:POST机身参数:范围:https://66395830-4e70-4a10-8f30-225fe9afd23.com/.defaultredirect_uri:https://cscglobal.sharepoint.com/teams/uatCLSService/BusinessLicense/KB/_api/Web/listsgrant_type:client_credentials(注意:我们还通过传递各自的参数尝试使用 password 和 authorization_code 值)客户秘密:XXXXXX客户 ID:XXXX

Method: POST Body parameters: scope:https://66395830-4e70-4a10-8f30-225fe9afd23b.sharepoint.com/.default redirect_uri:https://cscglobal.sharepoint.com/teams/uatCLSService/BusinessLicense/KB/_api/Web/lists grant_type:client_credentials ( note: we have also tried with password and authorization_code values by passing respective parameters ) client_secret:XXXXXX client_id:XXXXX

推荐答案

我认为您可能以错误的方式设置了范围.据我所知,它应该是 https://yourSite.sharepoint.com/.default或详细范围,例如:https://yourSite.sharepoint.com/Sites.ReadWrite.All

I think you may set the scope in a wrong way. As far as I know, it should be https://yourSite.sharepoint.com/.default or detailed scope, such as: https://yourSite.sharepoint.com/Sites.ReadWrite.All

现在建议 使用 Microsoft Graph API 管理您的 sharepoint 站点 使用 Microsoft Graph API 管理您的 sharepoint 站点.

And now it is suggested to use Microsoft Graph API to manage your sharepoint site use Microsoft Graph API to manage your sharepoint site.

它提供了一个统一的可编程性模型,您可以使用它来访问 Office 365、Windows 10 和企业移动性 + 安全性中的海量数据.

It provides a unified programmability model that you can use to access the tremendous amount of data in Office 365, Windows 10, and Enterprise Mobility + Security.

这篇关于“error_description":“抛出了“Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException"类型的异常."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆