Use this script to generate a JWT for MapkitJS.
Written using node.js.
-
Create a Maps ID and private key as described here. Make sure to download the private key and store it in a safe place.
-
Edit the options object in
mapkitjs-jwt-generator.js
so it contains the following information specific to your team and expiry date:- keyid
- issuer
- expiresIn
-
From the terminal. Run this script, passing in the path to the private key.
node jwt-generator.js path/to/your/key.here
- The terminal will output the JWT. Copy it and use in your projects.
Adapted from a blog post by Jamie Tanna.