使用OAuth 2.0令牌进行身份验证时发生未经授权的错误 [英] Unauthorized error while Authenticating with OAuth 2.0 token

查看:131
本文介绍了使用OAuth 2.0令牌进行身份验证时发生未经授权的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在参与一些开发活动,该应用程序在Office 365租户外部运行.在这种情况下,我需要使用客户端ID和客户端密钥进行一些静默身份验证,例如通过引用此方法来授权Graph API的方式

I'm involving some development activity which the app running outside the Office 365 tenant. In that i need to do some silent authentication using Client ID and Client Secret key like the way of authorizing the Graph API by referring this developer link.

像这种方法一样,我将替换SharePoint URL,并获取授权令牌并使用该令牌,我面临着诸如未授权之类的错误.

Like this kind of approach i'm replacing SharePoint URL instead and getting authorization token and using that token i'm facing the error like unauthorized.

下面提到了来自Rest Client的响应,以获取令牌和API调用的响应.

Below mentioned response from Rest Client to get Token and Response of API call.

宝贵的答复应该有助于我进一步实施.

Valuable reply should helpful for me to implement further.

预先感谢

Vignesh S.

Vignesh S.

推荐答案

你好,

您是否按照https://developer.microsoft.com/zh-CN/graph/docs/concepts/auth_v2_service中的步骤进行操作?
您必须将新应用注册到您的租户,并首先获得管理员的同意,并要求租户中的/adminconsent.获得同意后,您可以调用TokenRequest帖子来获取令牌.

Did you follow the steps in https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_service ?
You must register the new app to your tenant, and obtain Administrator consent first with request to /adminconsent in the tenant. Once you have the consent, you can invoke TokenRequest post to get the token.

简而言之,您可能会错过本文的第1-3步.

In short you might miss the step 1-3 from the article.


这篇关于使用OAuth 2.0令牌进行身份验证时发生未经授权的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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