{"id":13941130,"url":"https://github.com/pelauimagineering/apple-music-token-generator","last_synced_at":"2025-07-20T04:30:42.259Z","repository":{"id":48972663,"uuid":"93716786","full_name":"pelauimagineering/apple-music-token-generator","owner":"pelauimagineering","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-17T21:10:59.000Z","size":24,"stargazers_count":281,"open_issues_count":11,"forks_count":53,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-27T10:35:58.758Z","etag":null,"topics":["apple-music","jwt-token","python","ruby"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pelauimagineering.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-08T06:50:56.000Z","updated_at":"2024-11-25T02:47:38.000Z","dependencies_parsed_at":"2023-02-10T12:00:57.786Z","dependency_job_id":null,"html_url":"https://github.com/pelauimagineering/apple-music-token-generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pelauimagineering/apple-music-token-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelauimagineering%2Fapple-music-token-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelauimagineering%2Fapple-music-token-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelauimagineering%2Fapple-music-token-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelauimagineering%2Fapple-music-token-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pelauimagineering","download_url":"https://codeload.github.com/pelauimagineering/apple-music-token-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelauimagineering%2Fapple-music-token-generator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266067254,"owners_count":23871324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple-music","jwt-token","python","ruby"],"created_at":"2024-08-08T02:01:11.951Z","updated_at":"2025-07-20T04:30:42.020Z","avatar_url":"https://github.com/pelauimagineering.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# apple-music-token-generator\n\nSome steps that help getting started creating the Apple Music JWT tokens needed to use MusicKit on iOS\n\n## Recent Change\n\nAdded a NodeJS version.\n\n\n## Getting Started\n\nThese instructions supplement the information found in the Get Started section of the Apple Music API Reference documents.\n\nFirst, you must follow the instructions at [Apple Music API Reference](https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/AppleMusicWebServicesReference/SetUpWebServices.html#//apple_ref/doc/uid/TP40017625-CH2-SW1)\n\nNext, follow the instructions below to help create your developer token in the JSON Web Token format.\n\n\n## Prerequisites\n\nA developer machine running macOS Sierra (10.12.5)\nYou will need to run Terminal and have root access, or can run sudo\nAfter following the instructions at the URL above, you should now have 3 pieces of data:\n\n- a MusicKit private key in a *.p8 file\n- a 10-digit key identifier in your Apple Developer account\n- your 10-digit Apple Developer Account Team ID\n\n\n## Installing (Python)\n\n### Step 1\n\n### Easy method:\n\nRun the following on the command line:\n```\nsudo easy_install pip\n```\n\n### Old method: \n\nDownload the Python package manager from [pip](https://pip.pypa.io/en/stable/installing/)\n\n```\nDownload the get-pip.py script from https://pip.pypa.io/en/stable/installing/\n```\n\nInstall Python package manager\n\n```\nsudo python get-pip.py\n```\n\n### Step 2\n\nNow that the Python Package Manager (pip) is installed, use it to install the Python JWT library\n\n```\nsudo pip install pyjwt\n```\n\nAdd the necessary Cryptography package\n\n```\nsudo pip install cryptography\n```\n\nAll of that was just housekeeping to get you ready for the main event... actually generating the token.\n\nUse you favourite editor to customize the script that will create your token.\n\n```\nopen -e music_token.py\n```\n\nCopy your MusicKit private key from the .p8 file you generated and downloaded.\n\n```\nsecret = \"\"\"-----BEGIN PRIVATE KEY-----\nREPLACE-THIS-WITH-YOUR-OWN-PRIVATE-KEY\n-----END PRIVATE KEY-----\"\"\"\n```\n\nSubstitute your 10-digit key identifier (kid) as found in your developer account\n\n```\nkeyId = \"9876543210\"\n```\n\nSubstitute your 10-digit Apple Developer Team ID\n\n```\nteamId = \"0123456789\"\n```\n\nRun the script\n\n```\n\u003e python music_token.py\n```\n\nThe script will output a sample curl command you can run to see if you were successful.\n\n```\n\n```\n\n## Installing and Running in Node\n\n### System requirements\nEnsure you have a current version of Node and npm running on your system.\n\n### Installation\nDownload the repo and run ```npm install``` in the project directory to install dependancies.\n\n### Configuration\nThe project supports ```.env``` and you can add the following to your own ```.env``` file in the project directory.\n\n```\nTEAM_ID=[YOUR_TEAM_ID_FROM_APPLE]\nKEY_ID=[YOUR_KEY_ID_FROM_APPLE]\n```\n\n### Running\nThere are two ways of using the Node create_token.js package:\n\nIn the project directory, run ```npm run generate``` and pass in the filename to your .p8 private key file.\n\n** *OR* **\n\nSimply run ```npm run generate``` follow the on screen prompts.\n\n- provide the file path/name\n- provide your Team ID\n- provide your Key ID\n\n\n### Testing\nThe script has built in tests and will display test results during runtime.\nIf you wish to skip the validation step (i.e. 'offline mode'), configure the ```VALIDATE_TOKEN``` flag in create_token.js\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n\n## Authors\n\n* **Anonymous Apple Marketing Guy** - *Initial work* - [Anonymous]\n* **Darren Baptiste** - *First Commit* - [Pelau Imagineering](https://github.com/pelauimagineering)\n* **Nate Blake** - *NodeJS version* - [n8blake](https://n8blake.com)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n## Acknowledgments\n\n* Hat tip to the folks in the MusicKit Lab at WWDC17\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpelauimagineering%2Fapple-music-token-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpelauimagineering%2Fapple-music-token-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpelauimagineering%2Fapple-music-token-generator/lists"}