Skip to main content

No project description provided

Project description

Apple Music Keyman

A small utility that gets Apple Music API keys for you. It even allows getting user tokens, which are a bit more annoying since they involve a whole OAuth flow.

This tool is rudimentary and a work in progress.

How Apple Music authorization works

You need a couple of things:

  1. Apple Developer subscription. Yes, a paid one
  2. A certificate generated with access to Apple Music & MusicKit APIs.
  3. A Key ID for that certificate.
  4. A Team ID for your developer account

Using the team ID, private key file (.p8) and key ID, you build a JWT that becomes your developer token. This token alone allows access to AM resources that aren't related to a user.

With that developer token, you can initiate an OAuth flow to get a user token. This one allows you to access the listening history for your account, for example.

Using Keyman (uvx)

A convenient option is to use uvx to run the tool, without installing it:

# Set up the tool
uvx am-keyman configure TEAM_ID_HERE KEY_ID_HERE KEY_FILE_PATH
# Run the entire flow (dev token, user token)
uvx am-keyman get-tokens

Using Keyman (pip)

The CLI utility is published on PyPI:

pip install am-keyman
am-keyman

Using Keyman (local development)

uv sync
uv build
# Set up the tool
uv run am-keyman configure TEAM_ID_HERE KEY_ID_HERE KEY_FILE_PATH
# Run the entire flow (dev token, user token)
uv run am-keyman get-tokens
# OPTIONAL: Get your developer token 
uv run am-keyman get-dev-token 
# OPTIONAL: Grab a user token for yourself
uv run am-keyman get-user-token DEV_TOKEN_HERE
# ... a web server will open up, follow the instructions
# ... after completion, the token will show up in the console

Important note

If you mean to grab a user token using the command-line utility, do not use Firefox.

The stricter security settings built into the browser will break the OAuth flow and it won't work.

Safari worked great for me.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

am_keyman-0.1.3.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

am_keyman-0.1.3-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file am_keyman-0.1.3.tar.gz.

File metadata

  • Download URL: am_keyman-0.1.3.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.14

File hashes

Hashes for am_keyman-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d18ded4b98fdcff350058f948a45d4d85a56b9ba5057167dd491d2d91cd2f06b
MD5 6c95216a62cc3753247a09d8cbf46111
BLAKE2b-256 6cfad843fe008b3d66e7d95c9f17cea453e528d562c44cab3062b3e0da1f98bd

See more details on using hashes here.

File details

Details for the file am_keyman-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: am_keyman-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.14

File hashes

Hashes for am_keyman-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8505b8981b8311a0cb5a3d409c9b1b7dff5474f6a64a7c26d3e623d1af95b961
MD5 a358d8314fe34a4d494895ae92680e64
BLAKE2b-256 a1906a50823c3b77c4a11d6f02d197922adf0400d99c8f5d81f3ea2c0cabc069

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page