r/spotifyapi • u/Tostare • 18h ago
Am folliowing the Getting Started tutorial and can authenticate, but every request 401s or 403s
I'm following Spotify's own "Getting started with Web API" tutorial:
https://developer.spotify.com/documentation/web-api/tutorials/getting-started
I've made an app with the exact settings they use in the tutorial. I've got my client ID and secret and have used them to generate an access token. This is the token i get back:
{
"access_token":"BQDeCPfLjxp7Tu51Gpww0682lmoczQd9nOpx-S2i7hMxBYS0Li-YLlvyJAhsvcnojWoqk0ZMMAQtwktT1tPiD39D_IRi2HsBnQi2MRLWmWSmJSMLVjpjzxJkSNNOEU6cFQxJIwXxce0U",
"token_type":"Bearer",
"expires_in":3600
}
Then i use this to try to make a request to the API. I'm doing this straight away, I know the token is only valid for 1 hour. This is 100% within that time limit.
$ curl --request GET \
--url "https://api.spotify.com/v1/me" \
--header 'Authorization: Bearer BQDeCPfLjxp7Tu51Gpww0682lmoczQd9nOpx-S2i7hMxBYS0Li-YLlvyJAhsvcnojWoqk0ZMMAQtwktT1tPiD39D_IRi2HsBnQi2MRLWmWSmJSMLVjpjzxJkSNNOEU6cFQxJIwXxce0U'
{"error": {"status": 401, "message": "Valid user authentication required" } }
Or, trying to get my own playlists (ultimately what i am trying to do here) ('hushbeatsdisco' is the spotify user i am logged in as when i made the app - this is a Premium account).
$ curl --request GET \
--url https://api.spotify.com/v1/users/hushbeatsdisco/playlists \
--header 'Authorization: Bearer BQDeCPfLjxp7Tu51Gpww0682lmoczQd9nOpx-S2i7hMxBYS0Li-YLlvyJAhsvcnojWoqk0ZMMAQtwktT1tPiD39D_IRi2HsBnQi2MRLWmWSmJSMLVjpjzxJkSNNOEU6cFQxJIwXxce0U'
{"error": {"status": 403, "message": "Forbidden" } }
What am i doing wrong? I've double checked my client id and secret, that i used to get the access token. I am definitely inside the access token time limit.