Announcements

Help Wizard

Step 1

NEXT STEP

Following along with the curl API tutorial, keep getting "Missing/invalid/expired access token"

Following along with the curl API tutorial, keep getting "Missing/invalid/expired access token"

Plan

Free/Premium

Country

UK

Device

Macbook Air

Operating System

MacOS

 

My Question or Issue

I'm following along with the Getting Started tutorial here.  

https://developer.spotify.com/documentation/web-api/tutorials/getting-started

 

This is in the terminal app on MacOS.  I have set up an app with the example settings in that tutorial.  Then, i do this part, with my id and secret:

curl -X POST "https://accounts.spotify.com/api/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=your-client-id&client_secret=your-client-secret"

That works and i get given an access token back.  Then i make the next request, using that access token (instead of the example here which is from the tutorial):

curl "https://api.spotify.com/v1/artists/4Z8W4fKeB5YxbusRsdQVPb" \
-H "Authorization: Bearer BQDBKJ5eo5jxbtpWjVOj7ryS84khybFpP_lTqzV7uV-T_m0cTfwvdn5BnBSKPxKgEb11"

I get an error back:
{
"error": {
"status": 401,
"message": "Missing/invalid/expired access token"
}
}

But, i used the token that the API just gave me, a few minutes previously.  (much less than an hour).  What am i doing wrong?



Reply
0 Replies

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 5 years ago  in Social & Random