Search code examples
javascriptjwtapple-mapsmapkit-js

Multiple origin when creating jwt token for Apple Maps?


I'm following this guide from Apple to create a jwt token to use with their Apple Maps JS Kit: https://developer.apple.com/documentation/mapkitjs/creating_and_using_tokens_with_mapkit_js

It works, but how can I set multiple origins? I wan't it to allow localhost, production-url and production-backend-url. But it looks like it only accepts a string.

Currently I'm doing:

origin:
  process.env.NODE_ENV === "development"
    ? "http://localhost:3000"
    : "https://production-url"

But how can it also allow the third domain?


Solution

  • The syntax for defining multiple origins is like this:

    origin: "http://localhost:3000,https://first.domain,https://second.domain"
    

    Figured this out by trial and error. Not documented anywhere I could find.