Announcements

Help Wizard

Step 1

NEXT STEP

Getting "Invalid access token" on POST /api/token

Getting "Invalid access token" on POST /api/token

Plan

Premium

Country
Colombia

 

Operating System

Windows 11

 

My Question or Issue


I am making a POST request to the /api/token endpoint in order to request an Access Token, however I'm getting a 401 - Invalid access token

This is the request I'm sending

 

 

 

 

 

 

 

 

 

 

 

 

 

Faraday::Request 
http_method=:post, 
path="/api/token", 
params={}, 
headers={
  "User-Agent"=>"Faraday v2.7.11", 
  "Authorization"=>"Bearer ZDZkNThkODE4ZjI0*************************jg6NzhkNzY1MTIxN2RiNDBjZGEwZmVhMDliOTIyYWUyYTA=", 
  "Content-Type"=>"application/x-www-form-urlencoded"},
 
 body="grant_type=authorization_code&code=AQCp7_N7EzijIBKwSFDXjQ57_QreKOVpy0gJmyNcwL0QCOfjwSe3-HpBk1E7WvVpvZdAK6TqyHMQTcN30nMTakqKSPU1nJWyc6En-4-hp0DwXCu74RU3c3wBIbgKEcIARFnQ9aNy_90GE2lBmM8ZDBjJZv3nK6ATS60N8p_7MPdj-LQfHOXMcNmYrQxf24H_UaH7tHriVM-CpAvh&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fadmin", 
  options=#<Faraday::RequestOptions (empty)>

 

 

 

 

 

 

 

 

 

 

 

 

 


Documentation says the Authorization header should be in the format 'Basic ***' but when I try it like that, I get the error "Only valid Bearer authentication supported"

I am 100% sure the string I'm sending in the header is a base64 encoded version of my_client_code:my_client_secret and what I'm sending in the body as code is the code I received before when my user authorized my app on Spotify

Thanks for the help 🙂

Reply
0 Replies

Suggested posts