Skip to content

Error: Unable to decrypt ProviderConfiguration the key used may be invalidated. Please clear data and try again. null #173

@ksenia834

Description

@ksenia834

Describe the bug

During implementation new feature, we've faced few issues, that seems related:

  1. getUserProfile, refreshToken requests return error "Unable to decrypt ProviderConfiguration the key used may be invalidated. Please clear data and try again. null"
  2. Exception on getting accessToken in Release mode: "Unable to decrypt TokenResponse the key used may be invalidated. Please clear data and try again. null". In Debug mode access token received successfully.

It seems similar issue was already reported and closed in 1.0.5 version #113, but for us it still reproduces on 1.0.13

To Reproduce issue 1

  1. Login with Okta user
  2. Get user profile or try refreshToken

Observed Behavior
Error "Unable to decrypt ProviderConfiguration the key used may be invalidated. Please clear data and try again. null" ocured

Expected Behavior
Received User's profile information

To Reproduce issue 2

  1. Login with Okta user
  2. Get accessToken

Observed Behavior
Application crash with exception:

2020-07-24 19:04:51.723 17647-17831/? E/AndroidRuntime: FATAL EXCEPTION: Thread-19
    AuthorizationException: {"type":5,"code":5006,"error":"Illegal block size. Unable to decrypt TokenResponse the key used may be invalidated. Please clear data and try again. null","errorDescription":"Unable to decrypt TokenResponse the key used may be invalidated. Please clear data and try again. null"}
        at com.okta.oidc.util.AuthorizationException$EncryptionErrors.byEncryptionException(Unknown Source:54)
        at com.okta.oidc.clients.sessions.SyncSessionClientImpl.getTokens(Unknown Source:17)
        at com.okta.oidc.clients.sessions.SessionClientImpl.getTokens(Unknown Source:2)
        at com.testapp.Okta.OktaAuthService.refresh(Unknown Source:13)
        at com.testapp.activities.HomeActivity.c(Unknown Source:2)
        at com.testapp.activities.c.run(Unknown Source:2)
        at java.lang.Thread.run(Thread.java:764)

Expected Behavior
User's accessToken (if available) and no crash

Code Snippet

Refresh token:

    sessionClient.refreshToken(object : RequestCallback<Tokens?, AuthorizationException?> {
        override fun onSuccess(result: Tokens) {
            listener?.onTokensRefreshed(result);
        }

        override fun onError(error: String, exception: AuthorizationException?) {
            listener?.onRefreshTokenError(error, exception);
        }
    })

Get user profile:

    sessionClient.getUserProfile(object : RequestCallback<UserInfo, AuthorizationException> {
        override fun onSuccess(result: UserInfo) {
            listener?.onUserProfileReceived(result);

        }

        override fun onError(error: String?, exception: AuthorizationException?) {
            listener?.onUserProfileError(error, exception);
        }
    })

Get access token of successfully signed-in users:

val accessToken = client?.sessionClient?.tokens?.accessToken

Environment

  • SDK Version: com.okta.android:oidc-androidx:1.0.13

Device Information

  • Device: Samsung S8 (Crash reports from Firebase also show Galaxy S10, LG G6, Galaxy A70)
  • OS Version: Android 9 (Crash reports from Firebase also show same issue for Android 10 and Android 8 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions