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

invalid_client on api/token call

invalid_client on api/token call

I'm using the Client Credentials Flow because I'm developing a web app. It's in Java and I'm using an Open Feign interface to call the Spotify API:

@FeignClient(value = "spotifyAccountService", url = "https://accounts.spotify.com")
public interface SpotifyAccountService
{
public static final String GRANT_TYPE = "client_credentials";

@PostMapping(value = "/api/token", //
headers = "Content-Type=application/x-www-form-urlencoded")
public AccessToken getToken(
@RequestHeader(name = "Authorization") String authorization,
@RequestBody String grantType);

}

 

The call in my REST controller looks like this:

 

private AccessToken getAccessToken()
{
if (this.accessToken == null)
{
String payload = this.clientID + ":" + this.clientSecret;
String authorization = "Basic " + Base64.getEncoder().encodeToString(payload.getBytes());

this.accessToken = this.spotifyAccountService.getToken(authorization,
"grant_type=" + SpotifyAccountService.GRANT_TYPE);
}

return this.accessToken;
}

 

What am I doing wrong?

Reply
0 Replies

Suggested posts

Type a product name