You may receive the following 401 error calling MS Graph endpoint (https://graph.microsoft.com)

{
    "error": {
        "code": "InvalidAuthenticationToken",
        "message": "CompactToken parsing failed with error code: 80049217",
        "innerError": {
            "date": "2022-08-16T19:00:22",
            "request-id": "xxx",
            "client-request-id": "yyy"
        }
    }
}

What’s the cause of the error?

The error typically happens due to the following reasons:

  • There is no Bearer Access Token in the Request’s Authorization Header
  • The value of the Authorization Header is in incorrect format
  • The Bearer access token is invalid

Below are few examples of incorrect HTTP Request’s Authorization Header resulting in the error:

# no token after 'Bearer'
Authorization:  Bearer

# no space between 'Bearer' and token
Authorization:  Bearereyxxxx....

# Bearer token unparsable or in incorrect json format
Authorization:  Bearer eyxxxx

Leave a Comment