0
votes

I have an android application that uses Azure AD B2C. Users can sign up using local account/email. Once the user logs into the android application, I'm trying to call the Microsoft Graph API to get the signed-in users details (specifically the Graph API UPN of the user, which is different than the UPN in Azure ad B2C).

The API call I'm trying to make is: https://graph.microsoft.com/v1.0/me I added the bearer auth token I receive when the user logs in.

However, I receive the following error:

  "error": {
    "code": "InvalidAuthenticationToken",
    "message": "CompactToken parsing failed with error code: 80049217",
    "innerError": {
      "date": "2020-06-17T06:11:32",
      "request-id": "b4e9757e-60d9-453f-820d-9f817831aa0c"
    }
  }
}

Any idea what I can do to get the user's Graph API UPN? Appreciate the help!

1
What endpoint did you use to obtain the access token? Can you try to call this API using developer.microsoft.com/en-us/graph/graph-explorer (this requires you to log in)?Carl Zhao
@CarlZhao i used my B2C endpoint (SignUpSignIn flow) to get the auth token. Should I using some other endpoint?DataGeek

1 Answers

0
votes

This error occurs when the token used is invalid. If you want to get the logged-in user information, you can request the API at here.

enter image description here

Don't forget to grant administrator consent for this permission,please checkhere.

Update

For Azure b2c users, it is currently not possible to call the Graph API.https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/526