Post

Replies

Boosts

Views

Activity

Reply to MusicKit web 403 error when authorizing
Hello, Has anyone been able to help you with the issue you were having? I am experiencing a similar issue, after successful sign-in and allowing my web app to connect with my Apple Music account, getting an error popup that states "Authorization failed. Please try again.". Developer Console Info: [Error] Authorization failed: AUTHORIZATION_ERROR: Unauthorized (anonymous function) (media.mydomain.com:398) If you've found a solution to this, would greatly appreciate any help!
5d
Reply to MusicKit - Authorization failed: AUTHORIZATION_ERROR: Unauthorized
Hi _Pancras, What I did was create an Identifier>Media ID as "media.com.mydomain", downloaded my MusicKit Key (created using the Media ID), then used script to generate token. Not really sure what to do from here, next step is to reach out to Apple support 🤷🏻‍♂️ Here is the script I am using to generate token: // generate_token.js const jwt = require('jsonwebtoken'); const fs = require('fs'); // Adjust these to your Apple Developer details: const privateKeyPath = '/home/theloungeuser/AuthKey_mykey.p8'; // Path to the .p8 const teamId = 'myTeamID'; // Your Apple Developer Team ID const keyId = 'myKeyID'; // 10-char Key ID for MusicKit // Read the private key const privateKey = fs.readFileSync(privateKeyPath, 'utf8'); // Generate Apple MusicKit dev token (valid max 180 days) const token = jwt.sign( { iss: teamId, iat: Math.floor(Date.now() / 1000), exp: Math.floor(Date.now() / 1000) + (60 * 60 * 24 * 180), // 180 days aud: 'appstoreconnect-v1' }, privateKey, { algorithm: 'ES256', header: { kid: keyId } } ); console.log(token);
1d