https://github.com/herrmannplatz/mapkit-token
🗺 Easily generate MapKit authorization tokens
https://github.com/herrmannplatz/mapkit-token
apple jwt mapkit mapkit-js
Last synced: 10 months ago
JSON representation
🗺 Easily generate MapKit authorization tokens
- Host: GitHub
- URL: https://github.com/herrmannplatz/mapkit-token
- Owner: herrmannplatz
- License: mit
- Created: 2018-06-12T20:47:16.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2023-12-20T20:05:16.000Z (about 2 years ago)
- Last Synced: 2025-04-05T11:34:22.547Z (10 months ago)
- Topics: apple, jwt, mapkit, mapkit-js
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/mapkit-token
- Size: 460 KB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mapkit-token
[](https://badge.fury.io/js/mapkit-token)
> 🗺 Easily generate [MapKit JS](https://developer.apple.com/documentation/mapkitjs) authorization tokens.
## Install
```
$ npm install mapkit-token
```
## Usage
```javascript
const generate = require('mapkit-token')
const key = fs.readFileSync('AuthKey_B1B1B1B1B1.p8')
const token = generate(key, 'B1B1B1B1B1', 'A1A1A1A1A1')
```
This generates an authorization token (valid for 30 minutes) which can be used to authorize against the mapkit JS API. Check the [documentation](https://developer.apple.com/documentation/mapkitjs/setting_up_mapkit_js) on how to generate a key.
### `generate(authKey, keyId, teamId[, ttl, origin])`
* **authKey**: MapKit Authorization Key
* **keyId**: MapKit JS Key ID.
* **teamId**: Apple Developer Team ID.
* **ttl**: Time to live in seconds. Defaults to 30 minutes.
* **origin**: Domain restrictions. Optional but recommended.
Returns the authorizaton token.