-
I was testing getting access to apple music api with a simple js script but I am always getting an unauthorized response 401 I ask here cause I know that you use apple api too if you could help me I would appreciate it eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODg3ODc1NDYsImlhdCI6MTY4ODc0NDM0Nn0.ndEvBoOOZ1oo--uEfvBGfFm99OF43I7Ko3rfzdeQDKmwDIRDbRkIbjNUakjTurNBXXnVWo9jaIatmW41lx4elw let authOptions = {
url: "https://api.music.apple.com/v1/catalog/US/search?term=positions&types=songs",
headers: {
Authorization: "Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODg3ODc1NDYsImlhdCI6MTY4ODc0NDM0Nn0.ndEvBoOOZ1oo--uEfvBGfFm99OF43I7Ko3rfzdeQDKmwDIRDbRkIbjNUakjTurNBXXnVWo9jaIatmW41lx4elw",
},
form: {
grant_type: "client_credentials",
},
json: true,
};
request.post(authOptions, async function (error, response, body) {
if (!error && response.statusCode === 200) {
console.log(body)
}
else console.log(response.statusCode)
}); const res = await axios.get(`https://api.music.apple.com/v1/catalog/US/search?term=positions&types=songs`, {
headers: {
Authorization: "Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODg3ODc1NDYsImlhdCI6MTY4ODc0NDM0Nn0.ndEvBoOOZ1oo--uEfvBGfFm99OF43I7Ko3rfzdeQDKmwDIRDbRkIbjNUakjTurNBXXnVWo9jaIatmW41lx4elw"
}
})
console.log(res); I also tried other endpoints to see if I messed up something with the search one but the same result |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
apple music is a pain, idk, have to figure out yourself |
Beta Was this translation helpful? Give feedback.
apple music is a pain, idk, have to figure out yourself