Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/herrmannplatz/mapkit-token
🗺 Easily generate MapKit authorization tokens
https://github.com/herrmannplatz/mapkit-token
apple jwt mapkit mapkit-js
Last synced: 4 days 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 6 years ago)
- Default Branch: main
- Last Pushed: 2023-12-20T20:05:16.000Z (11 months ago)
- Last Synced: 2024-04-14T06:17:18.833Z (7 months ago)
- Topics: apple, jwt, mapkit, mapkit-js
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/mapkit-token
- Size: 460 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mapkit-token
[![npm version](https://badge.fury.io/js/mapkit-token.svg)](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.