【发布时间】:2020-08-22 06:14:28
【问题描述】:
您遇到问题的图形 API 请求 https://graph.microsoft.com/v1.0/me/messages
Graph API error message
{
'error': {
'code': 'InvalidAuthenticationToken',
'message': 'Access token validation failure. Invalid audience.',
'innerError': {
'request-id': '12e4940d-58af-4d64-98ab-4b3fe645afb8',
'date': '2020-05-05T13:57:38'
}
}
}
说明: 实施用例,用户可以在我们的应用程序中提取电子邮件,以使用 Microsoft graph 下载附件并将其合并到中心位置。
Web 应用前端使用 Angular 开发,后端使用 Spring Boot REST API 开发。
在 Angular 中集成 MSAL 以验证用户并获取有效令牌。
code configuration :
MsalModule.forRoot({
clientID: '83de5e6f-6a5b-48f4-8b64-5e8d6e70aa9d',
authority: 'https://login.microsoftonline.com/common/',
redirectUri: 'http://localhost:4200/TestLawyer/mail',
cacheLocation: 'localStorage',
// storeAuthStateInCookie: isIE, // set to true for IE 11
popUp: true,
consentScopes: ['user.read'],
unprotectedResources: ['https://www.microsoft.com/en-us/'],
protectedResourceMap: protectedResourceMap,
// logger: loggerCallback,
correlationId: '1234',
piiLoggingEnabled: true
})
我在本地存储中获得了令牌。在我的解决方案中,我想将令牌传递给我们的 Spring Boot Rest 服务器,以使用 Microsoft Graph 提取电子邮件。
您能否像实施此用例的任何教程或指南一样帮助我。
【问题讨论】:
标签: microsoft-graph-api access-token