为什么我得到“令牌不存在错误”每当我试图打电话https://graph.microsoft.com/v1.0/me [英] Why am I getting "Token does not exist error" whenever I am trying to call https://graph.microsoft.com/v1.0/me

查看:352
本文介绍了为什么我得到“令牌不存在错误”每当我试图打电话https://graph.microsoft.com/v1.0/me的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下步骤创建了Bearer Token

Created Bearer Token using the following steps

<<无法粘贴链接>>

<< Unable to paste link >>

client_id:{{client_id}}

范围:https://graph.microsoft.com/.default

client_secret:{{secret}}

grant_type:client_credentials

client_id: {{client_id}}
scope:https: //graph.microsoft.com/.default
client_secret: {{secret}}
grant_type: client_credentials

响应

{

" token_type":" Bearer",

" expires_in":3600,

" \\ text_expires_in" ;:3600,

" access_token":{{token}}

}

Response
{
"token_type": "Bearer",
"expires_in": 3600,
"ext_expires_in": 3600,
"access_token": {{token}}
}

当我尝试以下列方式使用令牌时,它给了我错误,有人说我应该有订阅的Office 365帐户,是原因 ?我可以使用我的电子邮件ID登录Office 365
帐户,但不确定订阅内容。

When I tried using the token in the following way , it gave me error, some say I am supposed to have Office 365 account with a subscription , is that the reason ? I am able to log into Office 365 account with my email id , not sure about subscription stuff though .

请告诉我如何在这里解决问题。

Please let me know how can I solve things here.

获取Microsoft带有* me *的图表网址[无法粘贴MSDN不允许的链接]

GET Microsoft Graph Url with *me* [ Unable to paste link as MSDN doesn't allow ]

授权:<<& Bearer_Token>>

Authorization : <<Bearer_Token>>

{

" error":{

" code":" OrganizationFromTenantGuidNotFound",

" message":" The租户指南'db404958-8858-4f05-8a8c-91cbd9d89b21'不存在。",

" innerError":{

"request-id":" 7048cf60-92d1-4514-86e9-a061c68b2238",

" dat e":" 2019-06-08 T01:58:58"

}

}

}

{
"error": {
"code": "OrganizationFromTenantGuidNotFound",
"message": "The tenant for tenant guid 'db404958-8858-4f05-8a8c-91cbd9d89b21' does not exist.",
"innerError": {
"request-id": "7048cf60-92d1-4514-86e9-a061c68b2238",
"date": "2019-06-08T01:58:58"
}
}
}

不确定为什么它在用户特定的
api电话中失败。我是否需要订阅O365帐户?

我有一个)365帐户但不确定订阅。

推荐答案

您好, 

Hello, 

您确实需要一个office365帐户才能使用。图中的"Me"调用应该在用户上下文中使用,为此,您需要使用访问令牌如果您想测试图形API调用,可以使用
https://aka.ms/ge上的帐户登录此处,并在用户上下文中尝试图形调用。

You do need an office365 account to work. "Me" call in Graph is supposed to be used in user context and for this, you need to use the access token of the user. If you want to test the graph API calls, you can sign in here using your account at https://aka.ms/ge and try the graph calls in user context.

使用客户端凭据获取令牌时,您将获得应用程序身份而非用户身份的令牌,管理员必须为应用程序授予权限,以便按照描述进行API调用

。授予权限后,您就可以进行图表调用。

When you use client credentials to obtain a token, you are obtaining the token for application identity and not user identity and an administrator will have to grant permissions for the application to make the API calls as described here. Once you grant the permissions you will be able to make graph calls.

当您进行API调用时,您不能使用"我"。作为标识符并且需要明确地给出< g class =" gr_ gr_1218 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace"数据-GR-ID =" 1218" ID = QUOT; 1218">用户< / g取代;
对象ID或UPN 

When you are making API calls, you cannot use "me" as an identifier and would need to explicitly give the <g class="gr_ gr_1218 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="1218" id="1218">users</g> object ID or UPN 

示例:  获取https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}

Example: GET https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}

参考:  https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=cs

Reference: https://docs.microsoft.com/en-us/graph/api/user-get?view=graph-rest-1.0&tabs=cs

希望这会有所帮助。 

Hope this helps. 


这篇关于为什么我得到“令牌不存在错误”每当我试图打电话https://graph.microsoft.com/v1.0/me的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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