I'm following Spotify's client credentials authorization flow, but all of my curl requests are returning {"error":"invalid_client"}
each time. Here are the instructions from Spotify:
The request will include parameters in the request body:
- grant_type - Set to “client_credentials”.
The header of this POST request must contain the following parameter:
- Authorization - A Base 64 encoded string that contains the client ID and client secret key. The field must have the format:
Authorization: Basic <base64 encoded client_id:client_secret>
They also include an example of a curl request:
$ curl -H "Authorization: Basic ZjM4ZjAw...WY0MzE=" -d grant_type=client_credentials https://accounts.spotify.com/api/token
Following their example, so far I've tried curl requests with:
- client_id and client_secret plain
- both base64 encoded seperately
- only one or the other encoded
- both encoded as one string with the colon
- both encoded as one string without the colon
- each of the above with a regenerated client secret
I'm using Ruby's Base64#encode64
method to encode. Still no luck. Any helpful hints?