Skip to content

YuKitsune/amjwt

Repository files navigation

🍎🎵
AMJWT

An Apple Music JWT generator.

GitHub Workflow Status Go Report Card PkgGoDev

Usage

Pre-requisites

Before you can generate a JWT, you'll need a key id, team id, and private key file. Rather than re-explaining that process, he's Apples docs: https://developer.apple.com/documentation/applemusicapi/getting_keys_and_creating_tokens

Once you have those ready, you can use amjwt to generate the JWT.

As a CLI

amjwt can be used as a CLI. You can provide the key and team IDs via the -k and -t flags respectively. -f can be used to specify the path to the private key file.

amjwt -k <key-id> -t <team-id> -f ./MyPrivateKey.p8

You can also pipe the private key in if necessary:

cat ./MyPrivateKey.p8 | amjwt -k <key-id> -t <team-id>

As a Package

You can also import amjwt as a go package:

import "github.com/yukitsune/amjwt"
keyId := "foo"
teamId := "bar"
privateKeyBytes, err = ioutil.ReadFile("./somewhere/MyPrivateKey.p8")
jwtString, err := amjwt.CreateJwt(keyId, teamId, expiryDays, privateKeyBytes)

Contributing

Contributions are what make the open source community such an amazing place to be, learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (feature/AmazingFeature)
  3. Commit your Changes
  4. Push to the Branch
  5. Open a Pull Request

But... Why?

Because for some reason, Apple wants you to hand craft the JWT to authenticate with the Apple Music API. This is much easier than hand crafting it every time.

About

Apple Music JWT generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published