无法使用 Microsoft Graph 获得管理员同意和访问令牌 API
Not able to get admin consent and access token using Microsoft Graph API
我想构建一个示例应用程序,它可以使用 Microsoft graph API。
我尝试实现的案例是Microsoft Graph : Get access without a user
- 我在 outlook live 上创建了个人帐户。
- 在 Azure 门户上注册了一个应用程序。
- 下一步是征得管理员同意。
征求管理员同意,我尝试点击:
https://login.microsoftonline.com/common/adminconsent
?client_id=clientId
&状态=状态
&redirect_uri=redirect-uri
获取错误:
我们无法从此 API 版本为 Microsoft 帐户颁发令牌。请联系应用程序供应商,因为他们需要使用协议的 2.0 版来支持此功能。
由于您使用个人帐户在 Azure 门户上注册应用程序,因此您只能 get access on behalf of a user。您只能访问登录用户日历。(个人帐户和 o365 帐户)
授权请求
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
client_id={your_client_id}
&response_type=code
&redirect_uri=https://localhost/myapp
&response_mode=query
&scope=https://graph.microsoft.com/Calendars.Read
&state=12345
然后你就可以使用你在url中得到的代码到get the access token。
我想构建一个示例应用程序,它可以使用 Microsoft graph API。
我尝试实现的案例是Microsoft Graph : Get access without a user
- 我在 outlook live 上创建了个人帐户。
- 在 Azure 门户上注册了一个应用程序。
- 下一步是征得管理员同意。
征求管理员同意,我尝试点击:
https://login.microsoftonline.com/common/adminconsent ?client_id=clientId &状态=状态 &redirect_uri=redirect-uri
获取错误:
我们无法从此 API 版本为 Microsoft 帐户颁发令牌。请联系应用程序供应商,因为他们需要使用协议的 2.0 版来支持此功能。
由于您使用个人帐户在 Azure 门户上注册应用程序,因此您只能 get access on behalf of a user。您只能访问登录用户日历。(个人帐户和 o365 帐户)
授权请求
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
client_id={your_client_id}
&response_type=code
&redirect_uri=https://localhost/myapp
&response_mode=query
&scope=https://graph.microsoft.com/Calendars.Read
&state=12345
然后你就可以使用你在url中得到的代码到get the access token。