librespot-java icon indicating copy to clipboard operation
librespot-java copied to clipboard

Create session with spotify token failed

Open cookiedevacc opened this issue 2 years ago • 0 comments

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

cookiedevacc avatar Oct 25 '23 14:10 cookiedevacc