Apple Music: Use MusicKit for the Web to Authorise Media Tokens #3897
Replies: 2 comments 2 replies
-
More specifically, the user authorization API is here: |
Beta Was this translation helpful? Give feedback.
-
There is a draft PR that should work on all web platforms including mobile. To manage expectations: Apple Music does not not issue a renewable token so the authentication workflow has to be repeated on expiry. The lifetime is not documented but I believe it is 6 months. Sadly the token and workflow is proprietary, not OAuth but the framework does store re-auth helper data in browser local storage. This local data is not documented so until tokens start expiring for users it is really hard to predict how clean the user experience will be. Also because it is browser localstorage it is tied to the url you use to access MA. Not ideal if you are using MA in HA with different internal/external hostnames. Without a time machine this is hard to test. Anyone with insider knowledge, I am on Discord |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Today, one must use a browser to acquire a media token from a cookie that expires after a few days in order to authorise (and continue to authorise) the Apple Music provider. Apple has a web-based (JavaScript) API to integrate with Apple Music, including support for user authorisation.
https://js-cdn.music.apple.com/musickit/v3/docs/index.html?path=/docs/introduction--page
It should be possible to integrate this API to authorise directly from the music assistant UI.
Beta Was this translation helpful? Give feedback.
All reactions