librespot-org / librespot-java

The most up-to-date open source Spotify client
Apache License 2.0
384 stars 94 forks source link

Create session with spotify token failed #753

Open basicemotions opened 1 year ago

basicemotions commented 1 year ago

Describe the bug I try to create player session using AuthenticationType.AUTHENTICATION_SPOTIFY_TOKEN, but it throw exception xyz.gianlu.librespot.mercury.MercuryClient$MercuryException: status: 403 When i use username and password for session it works fine.

To Reproduce

Session.Builder sessionBuilder = new Session.Builder(conf);
sessionBuilder
                .credentials(
                        Authentication.LoginCredentials.newBuilder()
                                .setTyp(Authentication.AuthenticationType.AUTHENTICATION_SPOTIFY_TOKEN)
                                .setUsername(profilePrefs.getProfile().getId())
                                .setAuthData(ByteString.copyFrom(tokenPrefs.getToken(), StandardCharsets.UTF_8))
                                .build()
                )
                .setPreferredLocale(Locale.getDefault().getLanguage())
                .setDeviceType(Connect.DeviceType.SMARTPHONE)
                .setDeviceId(deviceId)
                .setDeviceName(deviceName);
playerSession = new WeakReference<>(sessionBuilder.create());

Expected behavior player session created succesfull

Screenshots/Stracktraces/Logs

Screenshot 2023-10-25 at 17 19 55

Version/Commit v1.6.3