2 Replies
      Latest reply on Dec 1, 2019 1:04 PM by nbolender
      nbolender Level 1 Level 1 (0 points)

        I set up a second MapKit JS ID and key last night, and now my existing application is throwing "initialization failed because the authorization token is invalid."


        The token has not changed (it is a long-lived, non-expired token). Additionally, creating a new token with the new key results in the same error.


        I have double and triple checked the claims. Is anyone else having this problem?

        • Re: MapKit JS - previously working token invalid
          theonlyvicki Apple Staff Apple Staff (40 points)

          Are there any other messages in the console? MKJS 5.31.2 includes client side logging for token errors that can be detected client-side.


          Some things to check, for troubleshooting. Reasons why a token might be invalid include:


          - The token is missing required fields.

          - The token has all required fields, but some values are incorrect.

          - The string provided for the origin claim in your token does not exactly match the Origin header passed by the browser. This string must match exactly, including protocol (http, https), trailing slashes, etc.

          - The token contains duplicate headers. You can check for duplicate headers by decoding the token at the command line. For example:

          echo "your-token-here" | tr "." "\n" | head -2 | base64 -D

          - The token was issued more than a year ago.

          - Your Apple Developer team has exceeded the number of requests allowed.