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

Use the function - redirect back to App, cannot get the TokenID

Open paperkiteSonny opened this issue 2 years ago • 0 comments

Github issues are for bug reports. If this is a question around usage or understanding please use Stack Overflow. https://stackoverflow.com/questions/tagged/uber-api

Library version: 0.10.x

When moving back(Redirect) to the app, get the error "error: AuthenticationError" (INVALID_RESPONSE). Please help to check the reason why cannot get the token-Id. Thanks

return  SessionConfiguration.Builder()
    .setClientId("xxxxxx")   // if needed, I can pass it privately.
    .setRedirectUri("${context.applicationInfo.packageName}.uberauth://redirect")
    .setEnvironment(SessionConfiguration.Environment.SANDBOX)
    .setScopes(
            arrayListOf(
                        Scope.PROFILE
            )
    )
    .build()

}

    binding.uberButtonWhite.setOnClickListener {
        val accessTokenStorage = AccessTokenManager(this)
        loginManager = LoginManager(accessTokenStorage, object: LoginCallback{
            override fun onLoginCancel() {
                Timber.d("onLoginCancel")
            }
            **override fun onLoginError(error: AuthenticationError) {
                Timber.d("$error")
            }**
            override fun onLoginSuccess(accessToken: AccessToken) {
                Timber.d("$accessToken")
            }
            override fun onAuthorizationCodeReceived(authorizationCode: String) {
                Timber.d(authorizationCode)
            }
        }, UberManager.getConfig(this))
        loginManager?.login(this)
    }
}

Expected Behavior:

paperkiteSonny avatar Feb 09 '23 22:02 paperkiteSonny