librespot-java
librespot-java copied to clipboard
Create session with spotify token failed
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
Version/Commit v1.6.3