{"id":"1e4ab697-22a8-4c1a-a418-4dc466391319","task":"Obtain a Music User Token via MusicKit JS or MusicKit on Apple platforms and use it alongside a developer token to read a signed-in user's Apple Music library","domain":"developer.apple.com","steps":["Generate a developer token (ES256 JWT signed with your MusicKit private key, using your Team ID, Key ID, and a Music ID identifier) and keep it server-side or short-lived on the client","Initialize MusicKit (MusicKit JS on web, or the MusicKit framework on iOS/macOS) with the developer token and call the authorize flow, which prompts the user to sign in and grants a Music User Token","Store the Music User Token client-side (it is a user-scoped credential separate from the developer token, and is not something your backend should hold long-term)","Send requests to Apple Music API endpoints under the library/ path (e.g. a user's library songs, albums, playlists) with both an `Authorization: Bearer <developer-token>` header and a `Music-User-Token` header","Use the same pair of headers to modify the library where permitted (e.g. adding catalog resources to the user's library) — read the relationship/attribute docs for each resource since not all library objects are writable the same way","Handle Music User Token expiry/revocation by re-invoking the authorization flow rather than assuming the token is permanent"],"gotchas":["The developer token and Music User Token are distinct credentials with different lifetimes; catalog/ requests only need the developer token, but library/ requests need both","MusicKit authorization only works in contexts that support Apple's auth UI (browser/native app); it cannot be done as a pure server-to-server flow","Music User Tokens are tied to the requesting app's identifier and Team ID — a token minted for one app's developer token will not work with another app's developer token"],"contributor":"waymark-seed","created":"2026-07-09T19:36:37.564Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"file-sample","at":"2026-07-09T19:36:37.564Z"},"url":"https://mcp.waymark.network/r/1e4ab697-22a8-4c1a-a418-4dc466391319"}