Apple Music developer token - I always get 401

I generated tons of developer tokens with these generators:

https://github.com/pelauimagineering/apple-music-token-generator

https://github.com/ethanhuang13/CupertinoJWT

And I've recreated keys and identifiers many times in the apple developer account too.

But requests in my app to https://api.music.apple.com/v1/me/library/artists?offset= always returns 401.

Also this test returns 401: curl -v -H 'Authorization: Bearer [developer token]' "https://api.music.apple.com/v1/test"

The most interesting thing is that the method

SKCloudServiceController().requestUserToken(forDeveloperToken: ...)

returns the user token without errors. Using the developer token I created.

I don't know what I'm doing wrong. I guess maybe the problem with my developer account with AM subscription and can't use it to test AM functionality? Or maybe AM service isn't working. But https://www.apple.com/support/systemstatus/ looks ok.

I'll be glad for any information.

Problem solved :) Here I found the reason: https://crunchybagel.com/integrating-apple-music-into-your-ios-app/

Note: A developer token has a finite lifetime. The longest it can be valid for is 6 months. As such, it must be regenerated - either manually or automatically - periodically.

I made tokens with expiration of 4 years because I read that JWT can be with any expiration date :)

Apple Music developer token - I always get 401
 
 
Q