Coder Social home page Coder Social logo

apple-music-token-generator's Introduction

apple-music-token-generator

Some steps that help getting started creating the Apple Music JWT tokens needed to use MusicKit on iOS

Getting Started

These instructions supplement the information found in the Get Started section of the Apple Music API Reference documents.

First, you must follow the instructions at Apple Music API Reference

Next, follow the instructions below to help create your developer token in the JSON Web Token format.

Prerequisites

A developer machine running macOS Sierra (10.12.5) You will need to run Terminal and have root access, or can run sudo After following the instructions at the URL above, you should now have 3 pieces of data:

  • a MusicKit private key in a *.p8 file
  • a 10-digit key identifier in your Apple Developer account
  • your 10-digit Apple Developer Account Team ID

Installing

Download the Python package manager from pip

Download the get-pip.py script from https://pip.pypa.io/en/stable/installing/

Install Python package manager

sudo python get-pip.py

Now that the Python Package Manager (pip) is installed, use it to install the Python JWT library

sudo pip install pyjwt

Add the necessary Cryptography package

sudo pip install cryptography

All of that was just housekeeping to get you ready for the main event... actually generating the token.

Use you favourite editor to customize the script that will create your token.

open -e music_token.py

Copy your MusicKit private key from the .p8 file you generated and downloaded.

secret = """-----BEGIN PRIVATE KEY-----
REPLACE-THIS-WITH-YOUR-OWN-PRIVATE-KEY
-----END PRIVATE KEY-----"""

Substitute your 10-digit key identifier (kid) as found in your developer account

keyId = "9876543210"

Substitute your 10-digit Apple Developer Team ID

teamId = "0123456789"

Run the script

> python music_token.py

The script will output a sample curl command you can run to see if you were successful.


Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • Anonymous Apple Marketing Guy - Initial work - [Anonymous]
  • Darren Baptiste - First Commit - Pelau Imagineering

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Hat tip to the folks in the MusicKit Lab at WWDC17

apple-music-token-generator's People

Contributors

pelauimagineering avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.