@@ -16,6 +16,8 @@ import androidx.annotation.VisibleForTesting
1616import androidx.lifecycle.Lifecycle
1717import com.auth0.android.Auth0Exception
1818import com.auth0.android.authentication.AuthenticationAPIClient
19+ import com.auth0.android.authentication.AuthenticationException
20+ import com.auth0.android.callback.AuthenticationCallback
1921import com.auth0.android.callback.Callback
2022import com.auth0.android.request.internal.GsonProvider
2123import com.auth0.android.result.Credentials
@@ -144,14 +146,7 @@ public class SecureCredentialsManager @VisibleForTesting(otherwise = VisibleForT
144146 return false
145147 }
146148 if (resultCode == Activity .RESULT_OK ) {
147- continueGetCredentials(
148- scope,
149- minTtl,
150- emptyMap(),
151- emptyMap(),
152- forceRefresh,
153- decryptCallback!!
154- )
149+ continueGetCredentials(scope, minTtl, emptyMap(), emptyMap(), forceRefresh, decryptCallback!! )
155150 } else {
156151 decryptCallback!! .onFailure(CredentialsManagerException (" The user didn't pass the authentication challenge." ))
157152 decryptCallback = null
@@ -552,16 +547,7 @@ public class SecureCredentialsManager @VisibleForTesting(otherwise = VisibleForT
552547 decryptCallback = null
553548 return @execute
554549 }
555-
556- val bridgeCredentials: OptionalCredentials
557- try {
558- bridgeCredentials = gson.fromJson(json, OptionalCredentials ::class .java)
559- } catch (ex: NullPointerException ) {
560- callback.onFailure(CredentialsManagerException (" Credentials could not be retrieved." ))
561- decryptCallback = null
562- return @execute
563- }
564-
550+ val bridgeCredentials = gson.fromJson(json, OptionalCredentials ::class .java)
565551 /* OPTIONAL CREDENTIALS
566552 * This bridge is required to prevent users from being logged out when
567553 * migrating from Credentials with optional Access Token and ID token
@@ -655,9 +641,8 @@ public class SecureCredentialsManager @VisibleForTesting(otherwise = VisibleForT
655641 callback.onSuccess(freshCredentials)
656642 } catch (error: CredentialsManagerException ) {
657643 val exception = CredentialsManagerException (
658- " An error occurred while saving the refreshed Credentials." , error
659- )
660- if (error.cause is IncompatibleDeviceException || error.cause is CryptoException ) {
644+ " An error occurred while saving the refreshed Credentials." , error)
645+ if (error.cause is IncompatibleDeviceException || error.cause is CryptoException ) {
661646 exception.refreshedCredentials = freshCredentials
662647 }
663648 callback.onFailure(exception)
@@ -670,7 +655,6 @@ public class SecureCredentialsManager @VisibleForTesting(otherwise = VisibleForT
670655 private val TAG = SecureCredentialsManager ::class .java.simpleName
671656 private const val KEY_CREDENTIALS = " com.auth0.credentials"
672657 private const val KEY_EXPIRES_AT = " com.auth0.credentials_access_token_expires_at"
673-
674658 // This is no longer used as we get the credentials expiry from the access token only,
675659 // but we still store it so users can rollback to versions where it is required.
676660 private const val LEGACY_KEY_CACHE_EXPIRES_AT = " com.auth0.credentials_expires_at"
0 commit comments