Post

Replies

Boosts

Views

Activity

Reply to How to get the Music User Token?
The only way officially is to use Apple's client libraries, which isn't great, unless you want to violate the agreements you signed with Apple and be at the mercy of Apple never changing the system, you're just going to have to use the client library. So, you can use MusicKit.js like so: const MusicKit = new Promise((r) => { if (window['MusicKit']) return r(window['MusicKit']); window.addEventListener("musickitloaded", () => r(window['MusicKit'])); }) as Promise<typeof window['MusicKit']>; const MKInstance = MusicKit.then((MusicKit) => MusicKit.configure({ developerToken: await getAppleMusicKey(), app: { name: "My Cool App", } })) let mut = MKInstance.then((mk) => mk.authorize()) // `mut` will be a promise that resolves with the user's MUT once the user logs in to the `MKInstance`
Apr ’24