How to create MusicKit User Token from server (no UI) for use in Android Smart Speaker

I've successfully created a Developer Token and I can retrieve catalog information.

What I need now is a way to create the User Token manually from our server. Here's our architecture.

  • Android based smart speaker will play Apple Music from user's library.
  • The server needs to do the searching for catalog and library music and send those results to the Android speaker for streaming.
  • I can't see an easy way to get the User Token from the server without a UI to authenticate.

What I'd like to be able to do for testing is use Postman / REST endpoint to pass in my Apple credentials and get a User Token.

Is this possible?

Longer term, our Smart Speaker admin app can provide a way for users to authenticate in the app and store the user token in their profile. But I need a way to generate one in the meantime.

How did you generate Developer Token, could you share some snippet, I wrote a script on my BE to generate Developer Token but it returns UnAuth to request.

How to create MusicKit User Token from server (no UI) for use in Android Smart Speaker
 
 
Q