adamint / spotify-web-api-kotlin

Spotify Web API wrapper for Kotlin, Java, JS, and Native - Targets JVM, Android, JS (browser), Native (Desktop), and Apple tvOS/iOS. Includes a Spotify Web Playback SDK wrapper for Kotlin/JS, and a spotify-auth wrapper for Kotlin/Android.
https://adamint.github.io/spotify-web-api-kotlin-docs/
MIT License
194 stars 21 forks source link

[Android] Using PKCE Authentication, the token scopes appears empty #311

Closed yannallain closed 1 year ago

yannallain commented 2 years ago

Hello,

Perhaps I'm missing something but I was trying to debug an issue while implementing the PKCE authentication from the library and, while logging the scopes of the API, I saw that the scopes were empty even though they were provided in the SpotifyPkceLoginActivityImpl.scopes property.

I also reproduced these empty scopes in the Android demo app

Issue: Token scopes of the API are empty When I want to check the scopes of the current api token, the scopes are always at null even if in the SpotifyPkceLoginActivityImpl all the list of available SpotifyScope is passed as override val scopes = SpotifyScope.values().toList()

Hence, for example, calling api.hasScope(SpotifyScope.PLAYLIST_READ_PRIVATE) always return false.

To Reproduce Steps to reproduce the behavior:

  1. Install the Android demo app
  2. Login with the PKCE method.
  3. Add some logs of the api.token.scopes.

Expected behavior The list of scopes is available from the api.token.scopes or from api.hasScope(SpotifyScope.*)

Smartphone:

adamint commented 2 years ago

Yep, this is definitely an issue! The token string is not stored. Thank you for reporting this