Getting and Using a MapKit JS Key

WWDC 2018

Posted by Den on September 20, 2018 · 8 mins read
Getting and Using a MapKit JS Key

Getting and Using a MapKit JS Key

WWDC 2018

Getting and Using a MapKit JS Key

WWDC 2018

Authorization Overview

Create a MapKit JS Key

  1. Create a Maps Identifier
  2. Create a MapKit JS Key
  3. Download your MapKit JS Key and saving it in a safe place

Create a Maps Identifier

  1. Select “Maps IDs” from the menu
  2. Click the + button in the upper right corner
  3. Give this identifier a description which should be the name of your website as it will appear to users
  4. Give this identifier a unique ID starting with the string “maps”

Create a New Key

  1. Click on “All” under the “Keys” subheading in the left-hand menu
  2. Click the + icon in the header
  3. Give this new key a name
  4. Check the “MapKit JS” checkbox
  5. Click the “Configure” button

Configure your New Key

  1. Select an identifier to associate with this key
  2. Click continue

3. Verify the information

4. Click “Confirm”

Download Your MapKit JS Key

You can only download this file once

  1. Click the “Download” button
  2. This file will be saved to your computer

Revoking a MapKit JS Key

MapKit Authentication Tokens are based on JWT

JWT Signing Libraries

JWT Token

We Recommend 2 JWT Configurations

  • Short lived tokens
  • Long lived tokens

Short Lived Tokens

  • Short (we recommend 30 min ) time to line
  • If copied, will stop working after expiry
  • Requires you to provide a server endpoint

JWT Section: Payload

JWT Sections: Auth Key

JWT Sections: Header

JWT Sections: Pull It All Together

Create a Server Endpoint

Long Lived Token

  • Does not require a server
  • Can be used on static websites
  • Can be synced to your release cycle
  • “origin” claim strongly recommended

Make a Map

Start Your Server

Take a Look in Safari

Authorization Header Containing Your Token