Microsoft Graph API token validation failure

前端 未结 3 636
逝去的感伤
逝去的感伤 2020-12-20 12:52

I would use Microsoft Graph API in my Angular Web application.

First I make connexion using msal library When I try log in with my profil I get this error

I

3条回答
  •  旧巷少年郎
    2020-12-20 13:31

    The issue is that you're using the id_token instead of the access token:

    let tokenid= sessionStorage.getItem('msal.idtoken');

    becomes something like:

    let tokenid= sessionStorage.getItem('msal.token'); // or msal.accesstoken

    Update(per Phillipe's comment)

    You need to select the scopes that you want to target in your application. So, it looks like you want the user profile, so you'll want to add the consentScopes property to specify which scopes your app will use:

    MsalModule.forRoot({
      clientID: "Tenant ID",
      authority: "https://login.microsoftonline.com/common/",
      redirectUri: "http://localhost:4200/",
      validateAuthority : true,
      popUp: true,
      consentScopes: ["user.read"]
    }),
    

提交回复
热议问题