Experimenting with MusicKit for Swift - Authentication

The first part of the series is on authenticating yourself as a developer of the Apple Developer Program. Earlier, it used to be a long process and was a pain. Now, with MusicKit, it is as simple as a checkmark.

Old Way

Summarising the older process -

  • Register a new key with MusicKit service enabled.
  • Use this key to generate a JSON web token.
  • Send a header with the JWT for every Apple Music API request.
  • For accessing the user’s library, generate a user token as well.

I found the whole process complicated and confusing. I tried my best to simplify the steps in the article Build a Music Chat iOS App Using SwiftUI, but it still felt like a lot of work.

New Way

All you’ve to do is check MusicKit under Services for your bundle identifier.

Apple Developer Portal

That’s it.

No private key.

No JWT.

No developer token or user token. They’re automatically generated.

I find it a fantastic improvement. We don’t have to worry about tokens anymore and instead focus on using the new APIs instead.