Skip to content

Latest commit

 

History

History
65 lines (39 loc) · 2.23 KB

README.md

File metadata and controls

65 lines (39 loc) · 2.23 KB

MapKit JS JWS token generator

Python 2.7 Python 3.6 MapKit JS

A python script that generates a JWT token for the new MapKit JS web API from Apple. The token generated is valid for 180 days.

In order to run the script this packages must be installed on your system:

You can check it with pip list command on your Terminal. If not presented install it with

sudo pip install pyjwt --user
sudo pip install cryptography --user 

Configuration

In order to generate a valid JWS token you must provide 3 fields and an optional, but recommended, one. The mandatory fields are...

  1. Private Key file. The file with .p8 extension downloaded from Apple developer website.
  2. Your Apple Team ID. Available in your developer profile.
  3. MapKit Api Key ID.

The optional is a domain restriction.

  1. Origin. URL where your mapkit web is hosted. If yoor website is under a subdomain you must include it.
# Mandatory fileds. 

private_key_file_path = "[YOUR_PRIVATE_KEY_FILE].p8"
apple_team_id = "YOUR_APPLE_TEAM_ID"
mapkit_key_id = "YOUR_MAPKIT_KEY_ID"

# Optional but recommended fields.

origin_domain = "http://subdomain.yourdomain.com"

Run Script

Open Terminal app on your macOS or Command Prompt on Windows and type the follwing command

python mapkitjs_token_generator.py

A couple of seconds later you will see something like this

Script output

Links

Contact

Any question or suggestion? You will find me on twitter at @fitomad