我有一个应用程序可以在使用 Microsoft 进行 sso 登录后获取令牌。我想创建使用该令牌的事件。但是当我使用该令牌创建事件时它会出错。由图形资源管理器生成的令牌工作正常,但从 sso 登录生成的令牌不起作用。
我正在使用角度。sso 的包是 @azure/msal-angular
this.authService.loginPopup({redirectUri: 'http://localhost:4200',scopes: [ 'openid' ,'profile' ,'email' ,'Calendars.ReadWrite', 'Calendars.Read' ,'User.Read']})
.subscribe({
next: (result) => {
console.log(result.accessToken); // using this access token
}
}
)
url - https://graph.microsoft.com/v1.0/me/calendar/events
body- {
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does noon work for you?"
},
"start": {
"dateTime": "2022-01-15T12:00:00",
"timeZone": "India Standard Time"
},
"end": {
"dateTime": "202-01-15T14:00:00",
"timeZone": "India Standard Time"
},
"location": {
"displayName": "Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address": "ankitgupyta8768@gmail.com",
"name": "Ankit Gupta"
},
"type": "required"
}
],
"allowNewTimeProposals": true,
"transactionId": "7E163156-7762-4BEB-A8C6-729EA81755A8"
}
response-
{"error":{"code":"NoPermissionsInAccessToken","message":"The token contains no permissions, or permissions can not be
understood.","innerError":{"oAuthEventOperationId":"7e74af78-358d-4f90-9b8d-b2656365592b","oAuthEventcV":"FyQYtJaGIm6+7397Aa/oLw.1.1","errorUrl":"https://aka.ms/autherrors#error-InvalidGrant","requestId":"3fb81b0a-42a8-47a0-995b-06d1301a3e0a","date":"2022-01-21T08:02:04"}}}