And*_*ica 2 azure-active-directory microsoft-graph-api
我目前正在尝试在 Node.js 中使用 Microsoft Graph 直接登录日历/用户。
到目前为止我所做的如下:
登录帐户并确保它当前有日历(电子邮件在 下注册@outlook.com)。
转到azure门户并创建一个新的AAD名称“Calendar Api”带有返回URL的Web APIhttp://localhost:3000
AAD -> 应用程序注册 -> 名称:测试,回复 url:localhost:3000,Microsoft Graph 所需的权限(用户读/写、日历读/写)、Windows AAD (offline_access)、授予权限、生成新密钥没有有效期。
转到 Postman 并开始根据以下 URL 生成新令牌:
https://login.microsoftonline.com/{APP_ID_URI}.onmicrosoft.com/oauth2/v2.0/token
Run Code Online (Sandbox Code Playgroud)
client_credentialshttps://graph.microsoft.com/.default我有200 OK一个令牌。
"aud": "https://graph.microsoft.com",
"roles": [
"User.ReadWrite.All",
"Calendars.Read",
"Calendars.ReadWrite"
],
Run Code Online (Sandbox Code Playgroud)
GET ON -> https://graph.microsoft.com/v1.0/users/with Authorization Bearer,上面的令牌将返回代码状态 200 以及我在步骤 1 中使用的用户帐户。
GET ON ->https://graph.microsoft.com/v1.0/calendars/使用 Authorization Bearer 并返回上述令牌"Resource not found for the segment 'calendars'."
上车 ->
https://graph.microsoft.com/v1.0/users/{user_id}/calendars或/calendar或/calendarView:
"code": "OrganizationFromTenantGuidNotFound",
"message": "The tenant for tenant guid '104fdcd9-76d1-4122-89a0-30cb00722de2' does not exist."
Run Code Online (Sandbox Code Playgroud)
我实际上没有代码,因为我首先使用 POSTMAN 来测试 API。
我希望获得事件列表或日历列表而不是错误。
经过一番挖掘,我发现了问题所在,所以这里是这个问题的完整解决方案。
| 归档时间: |
|
| 查看次数: |
2987 次 |
| 最近记录: |