Announcements

Help Wizard

Step 1

NEXT STEP

Get Available devices, getting no devices.

Solved!

Get Available devices, getting no devices.

 

Plan

Free

Country

India 

Device

Web API

Operating System

MacOS

 

My Question or Issue

Using the Spotify Java API (https://github.com/spotify-web-api-java/spotify-web-api-java/), I am not able to get the list of devices. Its showing the following exception: 

se.michaelthelin.spotify.exceptions.detailed.UnauthorizedException: Permissions missing

and when I try the Developer API: I get an empty array. 

 What could be wrong? Any ideas?

 

CodeNiCK

Reply

Accepted Solutions
Marked as solution

Yes something like this worked for me:

 

AuthorizationCodePKCERequest authorizationCodePKCERequest = spotifyApi.authorizationCodePKCE(code, codeVerifier)
.setQueryParameter("scope", "user-read-playback-state")
// .setQueryParameter("scope", "user-library-read")
.setQueryParameter("scope", "playlist-read-private")
.build();

View solution in original post

4 Replies

Or you are using Client Credentials you can't use with this endpoint, and/or you don't use the user-read-playback-state scope.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Well then how do I set a scope for the current context? I do not see any direct API call here or on Spotify Java Web API.

se.michaelthelin.spotify.exceptions.detailed.ForbiddenException: Insufficient client scope.
at se.michaelthelin.spotify.SpotifyHttpManager.getResponseBody(SpotifyHttpManager.java:338)
at se.michaelthelin.spotify.SpotifyHttpManager.get(SpotifyHttpManager.java:174)
at se.michaelthelin.spotify.requests.AbstractRequest.getJson(AbstractRequest.java:110)
at se.michaelthelin.spotify.requests.data.personalization.simplified.GetUsersTopTracksRequest.execute(GetUsersTopTracksRequest.java:49)
 

When using this code, you need to add .setScope("user-read-playback-state scope") in between SpotifyApi.Builder() and 

  .build();

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.
Marked as solution

Yes something like this worked for me:

 

AuthorizationCodePKCERequest authorizationCodePKCERequest = spotifyApi.authorizationCodePKCE(code, codeVerifier)
.setQueryParameter("scope", "user-read-playback-state")
// .setQueryParameter("scope", "user-library-read")
.setQueryParameter("scope", "playlist-read-private")
.build();

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