Error when authenticate MusicKit instance

365 views Asked by At

whenever I try to authenticate a MusicKit instance the popup alway shows 'Problem Connecting There may be a network issue. '. When reloading the popup it shows the login screen, but after I did log in it shows the same error page again.

On the first error screen I get the following error in the console. A searching for the error it seems to be connect to ember js.

Error while processing route: woa Failed to construct 'URL': Invalid URL TypeError: Failed to construct 'URL': Invalid URL

TypeError: Failed to construct 'URL': Invalid URL

On the second error page I find the following error in the console:

Error while processing route: oauth-screen

This happens both on Brave and Safari.

Is this a bug or did i something wrong?

My Code:

<html>

<head>
    <script src="https://js-cdn.music.apple.com/musickit/v1/musickit.js"></script>
</head>

<body>
    <script>
        document.addEventListener('musickitloaded', function () {
            MusicKit.configure({
                developerToken: 'My token',
                debug: true,
                suppressErrorDialog: false
            });

            let music = MusicKit.getInstance();

            music.authorize().then(function (response) {
                console.log(response);
            });
        });
    </script>
</body>

</html>
1

There are 1 answers

1
CptCookie On

The Code is fine, but I opened it directly from disk. For an unknown reason, musickit does not like this. It needed to be served via a small HTTP server to work properly.