Hello guys! This is probably going to be a super dumb question for a lot of you but im having big time issues creating a developer token. Mainly i guess with not being able to verify the signature i followed the steps in apple music docs and created my MusicKitIdentifier and downloaded my private key. When i plug the token generated into jwt.io the headers and payloads are displayed correctly but i get the warning at the bottom saying it invalid signature. Im not sure whats wrong Ive spent hours troubleshooting. I get response 401 not authorized when i try to test a request with any token.
import jwt
import jsonimport requestsimport timekeyfile = open("AuthKey_[keyid].p8","r")key = keyfile.read()time_now = time.time()time_later = 1599097116token = jwt.encode({'iss': '[accountid]', 'iat':time_now, 'exp':time_later}, key ,headers={'kid':'[keyid]','alg':'ES256'})print(token)url = 'https://api.music.apple.com/v1/'headers = {'Authorization': f"Bearer {token}"}response = requests.get(url,headers=headers)print(response)
Post
Replies
Boosts
Views
Activity
Hello guys! This is probably going to be a super dumb question for a lot of you but im having big time issues creating a developer token. Mainly i guess with not being able to verify the signature i followed the steps in apple music docs and created my MusicKitIdentifier and downloaded my private key. When i plug the token generated into jwt.io the headers and payloads are displayed correctly but i get the warning at the bottom saying it invalid signature. Im not sure whats wrong Ive spent hours troubleshooting. I get response 401 not authorized when i try to test a request with any token.import jwtimport jsonimport requestsimport timekeyfile = open("AuthKey_[keyid].p8","r")key = keyfile.read()time_now = time.time()time_later = 1599097116token = jwt.encode({'iss': '[accountid]', 'iat':time_now, 'exp':time_later}, key ,headers={'kid':'[keyid]','alg':'ES256'})print(token)url = 'https://api.music.apple.com/v1/'headers = {'Authorization': f"Bearer {token}"}response = requests.get(url,headers=headers)print(response)