apple-id-client-secret

A simple generator for Apple ID client secret JWTs.

Usage no npm install needed!

<script type="module">
  import appleIdClientSecret from 'https://cdn.skypack.dev/apple-id-client-secret';
</script>

README

Apple ID Client Secret

The Apple ID REST API for exchanging authorization codes or refresh tokens for access tokens requires a client secret in the form of a signed JWT. This simple library will generate the signed JWT using minimal configuration.

Implementation based on Generate and Validate Tokens documentation from Apple and built using the jsonwebtoken package from Auth0.

Install

$ npm install apple-id-client-secret

or

$ yarn add apple-id-client-secret

Usage

import { createClientSecret } from "apple-id-client-secret"

const clientSecret: string = createClientSecret({
  keyId: "{key ID from Apple}",
  bundleId: "com.example",
  teamId: "{team ID frmo Apple}",
  privateKey: `-----BEGIN PRIVATE KEY-----
{your}
{private}
{key}
-----END PRIVATE KEY-----`;
});

License

This project is licensed under the MIT license. See the LICENSE file for more info.