Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

{"error":"unsupported_grant_type"}

{"error":"unsupported_grant_type"}

Hey, I'm using the php sdk api https://github.com/jwilsson/spotify-web-api-php

and trying to connect the user. I log in using the link

 

 

https://accounts.spotify.com/authorize?
client_id=--id--
&redirect_uri=https%3A%2F%2Fwww.testsite.com%2Fspotify_connect%2F
&response_type=code
&scope=user-read-email

 

 

and get a code in return and I've traced the code towards the curl in Request->send()

the full link is

 

 

https://accounts.spotify.com/api/token?
client_id=--client--&
code=--returned_code--
&grant_type=authorization_code
&redirect_uri=https%3A%2F%2Fwww.testsite.com%2Fspotify_connect%2F
&client_secret=--secret--

 

 

I get this in return:

 

 

{"error":"unsupported_grant_type","error_description":"grant_type parameter is missing"}

 


I've tried sending the authorization in the header as well. Same result

 

 

Authorization: Basic base64_encode(--clientid--:--clientsecret--);

 


What am I doing wrong?

Using the

 

https://accounts.spotify.com/api/token?grant_type=client_credentials

 


is working like a charm, but using the code I get in return does not work.

Thanks for help 🙂

 

Reply
1 Reply

I found that if I edit the code to not use http_build_query($parameters);

to convert array of parameters into the url-string, but pass the strings directly to the url it works. So how is http_build_query destroying the grant_type= authorization_code?

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/ 4 years ago  in Social & Random