我目前正在尝试在 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'."
上车 -> …