403 / 40300 "Invalid authentication" on every /me request, even with a new key and Media ID

My MusicKit setup worked for about a week, then every request that uses a Music User Token started failing with 403, code 40300, "Invalid authentication".
That includes GET /v1/me/storefront. Catalogue requests with the same developer token still work.

What I've tried, none of which helped:

  • Signing in again through MusicKit JS (the sign-in itself succeeds)
  • A new MusicKit key, twice
  • A new Media ID with a new key tied to it
  • Accepting the latest program agreements, then signing in again

MusicKit JS in Safari gets the same refusal right after sign-in, so it isn't my server code. My Apple Music subscription is active, and I'm signing in with
the account that holds it.

Has anyone seen user tokens rejected like this and found the cause? I've seen a suggestion that an Apple Account password change can trigger it, but nothing
about how to recover. Feedback filed as FB25575398

Answered by DTS Engineer in 917193022

Thanks for filing FB25575398, and for separating what fails from what still works. Catalog requests succeed with the same developer token, and only the requests that carry a Music User Token return 403.

The Apple Music API HTTP Status Codes reference describes 403 Forbidden this way:

The request wasn't accepted due to an issue with the music user token or because it's using incorrect authentication. (For personal endpoints) Authentication issues may occur if the account hasn't accepted the Media and Apple Music privacy setting.

The reference doesn't describe the 40300 code. The WWDC22 session Meet Apple Music API and MusicKit covers when a Music User Token stops working. It says the token "may become invalid based on changes to a person's subscription or password," and that signing in again refreshes it.

If Feedback Assistant asks you for more information on FB25575398, please attach what it asks for.

If you're seeing the same failure, please file your own bug report using Feedback Assistant. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports.

Thanks for filing FB25575398, and for separating what fails from what still works. Catalog requests succeed with the same developer token, and only the requests that carry a Music User Token return 403.

The Apple Music API HTTP Status Codes reference describes 403 Forbidden this way:

The request wasn't accepted due to an issue with the music user token or because it's using incorrect authentication. (For personal endpoints) Authentication issues may occur if the account hasn't accepted the Media and Apple Music privacy setting.

The reference doesn't describe the 40300 code. The WWDC22 session Meet Apple Music API and MusicKit covers when a Music User Token stops working. It says the token "may become invalid based on changes to a person's subscription or password," and that signing in again refreshes it.

If Feedback Assistant asks you for more information on FB25575398, please attach what it asks for.

If you're seeing the same failure, please file your own bug report using Feedback Assistant. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports.