This Netlify plugin allows you to generate MapKit JS each time you deploy a website on Netlify. The token’s scope will be reduced to the URL of the deployment.
Install this plugin by adding this to your netlify.toml
file:
[[plugins]]
package = "netlify-plugin-mapkitjs-token"
The following configuration parameters must be specified:
Environment variable name | Input name | Description |
---|---|---|
MAPKIT_JS_TEAM_ID |
teamId |
Apple development team ID |
MAPKIT_JS_KEY_ID |
keyId |
The ID of the private key. |
MAPKIT_JS_AUTH_KEY |
authKey |
The Base64-encoded contents of the .p8 key file. |
MAPKIT_JS_TOKEN_ENV_VARIABLE |
tokenEnvVariable |
The name of the environment variable used to store the token. |
MAPKIT_JS_TTL |
ttl |
The number of seconds the token should be valid. |
MAPKIT_JS_ORIGIN |
origin |
The domain the token is restricted to. Uses the Netlify deploy domain by default. |
The simplest way to define your parameters is to set the environment variables from Netlify’s web UI. You can also use plugin inputs instead.
To get a private key, follow Apple’s instructions.
MAPKIT_JS_TOKEN_ENV_VARIABLE
specifies the name you can use to access your
token. The
Netlify documentation
gives more information about which name you should use depending on your
framework.