Skip to content

Latest commit

 

History

History
79 lines (64 loc) · 2.61 KB

README.md

File metadata and controls

79 lines (64 loc) · 2.61 KB

amdevtok - Apple Music Developer Token creation utility based on JWT C Library

A simple command line program amdevtok to generate Apple Music Developer Token. Based on JWT C Library by Ben Collins.

Build Requirements

Documentation

GitHub Pages

Apple Music Developer Token

Prerequisite

  • cmake
  • autoconf
  • autoreconf
  • automake
  • libtool
  • jansson
  • jansson-devel
  • openssl
  • openssl-devel
  • check
  • check-devel
  • patch

Build Instructions

  1. Apply amdevtok patch
  • patch -p1 < ./amdevtok.diff
  1. Compile libjwt
  • 2.1 With GNU Make: Use autoreconf -i to create project files
  • 2.2 ./configure.
  • 2.3 make all: build library.

Because amdevtok add non-standard function to the original libjwt source, it is staticly linked to libjwt object files, so there is no need to make install to install libjwt libraries into system.

  1. Compile amdevtok
  • sh make-amdevtok

This will compile amdevtok binary and create a symbol link amdevtokd, please note the trailing 'd'.
amdevtok will just print result, amdevtokd will also print the original payload.

How to use amdevtok

amdevtok is static linked and can be copied anywhere has openssl/GnuTLS and jansson support. Usage is very straightfoward.

  1. Have your private key(.p8 file), kid and team id ready;
  2. execute amdevtok;
  3. Copy the results and go.

Usage: amdevtok private_key kid teamid [exp-length-in-seconds]

By default, expiration is plus 90 days:
  ./amdevtok /path/to/my.p8 ABC123DEFG DEF123GHIJ

Add 4th optional parameter to specify expiration period, eg. Expire in 1 hour:
  ./amdevtok /path/to/my.p8 ABC123DEFG DEF123GHIJ 3600

To print decoded payload as long as encoded message, use `amdevtokd` instead of `amdevtok`:
  ./amdevtokd /path/to/my.p8 ABC123DEFG DEF123GHIJ

Example output:
#./amdevtokd ./AuthKey_ABC123DEFG.p8 ABC123DEFG DEF123GHIJ
{
    "alg": "ES256",
    "kid": "ABC123DEFG"
}

{
    "exp": 1527368388,
    "iat": 1519592388,
    "iss": "DEF123GHIJ"
}
ewogICAgImFsasdfasdfasdfCAia2lkIjogasdfasdfiCn0K.CnsKICAgICJleHAiOasdfasdfasdfImlhdCI6IDE1MTfasdfasdfXNzIjogIkRFRjEyasdfaISUoiCn0K.61234124asdfffCU0KWgc0vmOPgENzb3sasdfasdfnfasdfzCl1IohAA