Post

Replies

Boosts

Views

Activity

Reply to 401-Unauthorized developer token in Apple Music API
having this issue with python cannot get the token working been working on it for hours please help! Just keep getting response 401 import jwt import jsonimport requestsimport timekeyfile = open("AuthKey_NBSNY9688H.pem","r")key = keyfile.read()time_now = time.time()time_later = 1599097116token = jwt.encode({'iss': 'WHW4BF9ZH6', 'iat':time_now, 'exp':time_later}, key ,headers={'kid':'NBSNY9688H','alg':'ES256'})token = token.decode('UTF-8')print(token)url = 'https://api.music.apple.com/v1/'headers = {'Authorization': "Bearer" + token}response = requests.get(url,headers=headers)print(response)
May ’20