When making an API call to
useEffect(() => {
getUsersFavoriteTracks();
}, []);
const getUsersFavoriteTracks = async () => {
const { data } = await axios.get(
"https://api.spotify.com/v1/search",
{
headers: {
Authorization: `Bearer ${token}`,
},
params: {
q: "Hotel Surrender",
type: "album",
},
}
);
console.log(data);
const { data2 } = await axios.get("https://api.spotify.com/v1/me/top/", {
headers: {
Authorization: `Bearer ${token}`,
},
params: {
type: "artists",
},
});
console.log(data2);
};
Solved! Go to Solution.
&20 is a space, but it just needs to be a user-to-read, without encoding the - symbols.
Did you get the access token by following the Authorization Code Flow?
Also, did you request it by using the Authorization Scope "user-top-read"?
Thanks Ximzend for narrowing it down, I didn't set the authorization scope.
If you could imagine this is my href to authenticate, how can I properly use the user-top-read?
&20 is a space, but it just needs to be a user-to-read, without encoding the - symbols.
Thanks Ximzend, problem solved.
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game…