11package com.auth0.android.authentication.storage
22
33import android.text.TextUtils
4+ import android.util.Log
45import androidx.annotation.VisibleForTesting
56import com.auth0.android.authentication.AuthenticationAPIClient
67import com.auth0.android.authentication.AuthenticationException
@@ -62,6 +63,12 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
6263 * parameter with the session transfer token. For example,
6364 * `https://example.com/login?session_transfer_token=THE_TOKEN`.
6465 *
66+ * ## Availability
67+ *
68+ * This feature is currently available in
69+ * [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access).
70+ * Please reach out to Auth0 support to get it enabled for your tenant.
71+ *
6572 * It will fail with [CredentialsManagerException] if the existing refresh_token is null or no longer valid.
6673 * This method will handle saving the refresh_token, if a new one is issued.
6774 */
@@ -77,6 +84,12 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
7784 * parameter with the session transfer token. For example,
7885 * `https://example.com/login?session_transfer_token=THE_TOKEN`.
7986 *
87+ * ## Availability
88+ *
89+ * This feature is currently available in
90+ * [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access).
91+ * Please reach out to Auth0 support to get it enabled for your tenant.
92+ *
8093 * It will fail with [CredentialsManagerException] if the existing refresh_token is null or no longer valid.
8194 * This method will handle saving the refresh_token, if a new one is issued.
8295 */
@@ -110,6 +123,17 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
110123 error
111124 )
112125 )
126+ } catch (exception: RuntimeException ) {
127+ Log .e(
128+ TAG ,
129+ " Caught unexpected exceptions while fetching sso token ${exception.stackTraceToString()} "
130+ )
131+ callback.onFailure(
132+ CredentialsManagerException (
133+ CredentialsManagerException .Code .UNKNOWN_ERROR ,
134+ exception
135+ )
136+ )
113137 }
114138 }
115139 }
@@ -122,6 +146,12 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
122146 * parameter with the session transfer token. For example,
123147 * `https://example.com/login?session_transfer_token=THE_TOKEN`.
124148 *
149+ * ## Availability
150+ *
151+ * This feature is currently available in
152+ * [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access).
153+ * Please reach out to Auth0 support to get it enabled for your tenant.
154+ *
125155 * It will fail with [CredentialsManagerException] if the existing refresh_token is null or no longer valid.
126156 * This method will handle saving the refresh_token, if a new one is issued.
127157 */
@@ -139,6 +169,12 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
139169 * parameter with the session transfer token. For example,
140170 * `https://example.com/login?session_transfer_token=THE_TOKEN`.
141171 *
172+ * ## Availability
173+ *
174+ * This feature is currently available in
175+ * [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access).
176+ * Please reach out to Auth0 support to get it enabled for your tenant.
177+ *
142178 * It will fail with [CredentialsManagerException] if the existing refresh_token is null or no longer valid.
143179 * This method will handle saving the refresh_token, if a new one is issued.
144180 */
@@ -442,6 +478,20 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
442478 exception, error
443479 )
444480 )
481+ } catch (exception: RuntimeException ) {
482+ /* *
483+ * Catching any unexpected runtime errors in the token renewal flow
484+ */
485+ Log .e(
486+ TAG ,
487+ " Caught unexpected exceptions for token renewal ${exception.stackTraceToString()} "
488+ )
489+ callback.onFailure(
490+ CredentialsManagerException (
491+ CredentialsManagerException .Code .UNKNOWN_ERROR ,
492+ exception
493+ )
494+ )
445495 }
446496 }
447497 }
@@ -527,5 +577,6 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
527577 // This is no longer used as we get the credentials expiry from the access token only,
528578 // but we still store it so users can rollback to versions where it is required.
529579 private const val LEGACY_KEY_CACHE_EXPIRES_AT = " com.auth0.cache_expires_at"
580+ private val TAG = CredentialsManager ::class .java.simpleName
530581 }
531582}
0 commit comments