android-sdk icon indicating copy to clipboard operation
android-sdk copied to clipboard

Authentication Token request return null access token with response type is empty

Open muyassar opened this issue 1 year ago • 5 comments

Issue found on 19 August 2024.

SDK Version:

com.spotify.android:auth:1.2.3

OS Version:

Android 13

Scope(s):

user-read-recently-played

Steps to reproduce:

  1. Request access token with auth api
val builder = AuthorizationRequest.Builder(context.getString(R.string.spotify_client_id),
                    AuthorizationResponse.Type.TOKEN, context.getString(R.string.spotify_callback_uri)
                )
                builder.setScopes(arrayOf("user-read-recently-played"))
                AuthorizationClient.openLoginActivity(activity, SPOTIFY_LOGIN_REQUEST_CODE, builder.build() )
  1. Get the response from on activity result
if(requestCode == Constants.SPOTIFY_LOGIN_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
            val response = AuthorizationClient.getResponse(resultCode, intent)
            val token = response.accessToken
            when(response.type) {
                AuthorizationResponse.Type.TOKEN -> {
                    val accessToken =  response.accessToken
                    Log.d("token", accessToken)
                }
                AuthorizationResponse.Type.EMPTY -> {
                    Log.d("empty", "empty")
                }
  1. Client ID and callback uri has been checked match from dashboard values.

Expected behaviour: response Type is TOKEN

Actual behaviour: response Type is EMPTY

muyassar avatar Aug 19 '24 03:08 muyassar

Having the same issue, did you fix it ? :)

QuentinSuchet avatar Jan 18 '25 11:01 QuentinSuchet

Hi, no:) it’s impossible unfortunately. Ask developers do not maintain it

Le sam. 18 janv. 2025 à 15:38, QuentinSuchet @.***> a écrit :

Having the same issue, did you fix it ? :)

— Reply to this email directly, view it on GitHub https://github.com/spotify/android-sdk/issues/366#issuecomment-2599681609, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEAZTNTEHKM6FUNR2RRWPT2LI4KXAVCNFSM6AAAAABMW7T72WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJZGY4DCNRQHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

AxelStein avatar Jan 18 '25 11:01 AxelStein

*sdk developers

Le sam. 18 janv. 2025 à 15:39, Axel Stein @.***> a écrit :

Hi, no:) it’s impossible unfortunately. Ask developers do not maintain it

Le sam. 18 janv. 2025 à 15:38, QuentinSuchet @.***> a écrit :

Having the same issue, did you fix it ? :)

— Reply to this email directly, view it on GitHub https://github.com/spotify/android-sdk/issues/366#issuecomment-2599681609, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEAZTNTEHKM6FUNR2RRWPT2LI4KXAVCNFSM6AAAAABMW7T72WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJZGY4DCNRQHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

AxelStein avatar Jan 18 '25 11:01 AxelStein

Got it working by using an ActivityResultContracts instead of the old OnActivityResult provided in the documentation and sample app :)

QuentinSuchet avatar Jan 18 '25 14:01 QuentinSuchet

Wow, thank you! I’ll give it a try

Le sam. 18 janv. 2025 à 18:06, QuentinSuchet @.***> a écrit :

Got it working by using an ActivityResultContracts instead of the old OnActivityResult provided in the documentation and sample app :)

— Reply to this email directly, view it on GitHub https://github.com/spotify/android-sdk/issues/366#issuecomment-2599730534, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADEAZTK7COD2JIM5Z3CZGE32LJNXJAVCNFSM6AAAAABMW7T72WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJZG4ZTANJTGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

AxelStein avatar Jan 18 '25 14:01 AxelStein