MusicKit JS Authentication Issues

I'm very excited to hear that Apple will be supporting a javascript version of their library. So excited, that I've already tried to create a test integration but I have run into a couple of issues. To begin with, it seems like the meta tag integration is able to initialize the declarative markup but MusicKit.configure does not. With the meta tags in place, I'm able to initiate an Apple Music OAuth screen and login (via Two Step) but the final screen presents the following error:


Problem Connecting

There may be a network issue.

Try Again


In addition, the URL shows the following parameter:


error=ERROR_FAILED_TO_VERIFY_JWT


However, I have been able to successfully call the API with the token I generated and I've made sure to create a fresh one in my authentication attempts. For example:


{"data":[{"id":"203709340","type":"songs","href":"/v1/catalog/us/songs/203709340","attributes":{"previews":[{"url":"https://audio-ssl.itunes.apple.com/apple-assets-us-std-000001/AudioPreview71/v4/ab/b3/48/abb34824-1510-708e-57d7-870206be5ba2/mzaf_8515316732595919510.plus.aac.p.m4a"}],"artwork":{"width":1500,"height":1500,"url":"https://is4-ssl.mzstatic.com/image/thumb/Music5/v4/5d/fa/37/5dfa370a-76a1-fba9-1768-23d2d73ab437/source/{w}x{h}bb.jpeg","bgColor":"321511","textColor1":"faf9f4","textColor2":"eee2ca","textColor3":"d2cbc6","textColor4":"c8b9a5"},"artistName":"Bruce Springsteen","url":"https://itunes.apple.com/us/album/dancing-in-the-dark/203708420?i=203709340","discNumber":1,"genreNames":["Rock","Music","Hard Rock","Arena Rock","Rock & Roll","Pop","Pop/Rock","Singer/Songwriter"],"durationInMillis":245298,"releaseDate":"1984-05-04","name":"Dancing in the Dark","isrc":"USSM18400416","albumName":"Born in the U.S.A.","playParams":{"id":"203709340","kind":"song"},"trackNumber":11,"composerName":"Bruce Springsteen"},"relationships":{"albums":{"data":[{"id":"203708420","type":"albums","href":"/v1/catalog/us/albums/203708420"}],"href":"/v1/catalog/us/songs/203709340/albums"},"artists":{"data":[{"id":"178834","type":"artists","href":"/v1/catalog/us/artists/178834"}],"href":"/v1/catalog/us/songs/203709340/artists"}}}]}


Looking forward to a resolution to this issue so I can begin hacking.


Thanks!

Replies

Scratch the authentication issue, this code authenticator worked:


https://codegists.com/snippet/javascript/indexjs_aljs_javascript

Thank you that script worked for me as well. was having the same auth issue.


Edit the script to do something like: console.log(jwtToken) on line 18 and thats the developer id you want for the player to work 😀

I am facing the same issue, the link provided is dead now. Do you have the working code?

bhanwarpsrathore -


Are you seeing issues with the JWT you are generating, or authentication in general?


Jae

I'm facing the same problem after two factor authentication
Problem Connecting
There may be a network issue.
Try Again

Can anybody help with this ??
Im having the same problem while trying to authenticate with my ionic app. I was thinking it may be because of 2FA, but I can't test otherwise, because 2FA is permanent. Looking for any help here.
  • Did you ever resolve this? I'm also building an ionic app and i get this same problem.

Add a Comment