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
@@ -80,6 +81,12 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
8081 * parameter with the session transfer token. For example,
8182 * `https://example.com/login?session_transfer_token=THE_TOKEN`.
8283 *
84+ * ## Availability
85+ *
86+ * This feature is currently available in
87+ * [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access).
88+ * Please reach out to Auth0 support to get it enabled for your tenant.
89+ *
8390 * It will fail with [CredentialsManagerException] if the existing refresh_token is null or no longer valid.
8491 * This method will handle saving the refresh_token, if a new one is issued.
8592 */
@@ -95,6 +102,12 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
95102 * parameter with the session transfer token. For example,
96103 * `https://example.com/login?session_transfer_token=THE_TOKEN`.
97104 *
105+ * ## Availability
106+ *
107+ * This feature is currently available in
108+ * [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access).
109+ * Please reach out to Auth0 support to get it enabled for your tenant.
110+ *
98111 * It will fail with [CredentialsManagerException] if the existing refresh_token is null or no longer valid.
99112 * This method will handle saving the refresh_token, if a new one is issued.
100113 */
@@ -128,6 +141,17 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
128141 error
129142 )
130143 )
144+ } catch (exception: RuntimeException ) {
145+ Log .e(
146+ TAG ,
147+ " Caught unexpected exceptions while fetching sso token ${exception.stackTraceToString()} "
148+ )
149+ callback.onFailure(
150+ CredentialsManagerException (
151+ CredentialsManagerException .Code .UNKNOWN_ERROR ,
152+ exception
153+ )
154+ )
131155 }
132156 }
133157 }
@@ -140,6 +164,12 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
140164 * parameter with the session transfer token. For example,
141165 * `https://example.com/login?session_transfer_token=THE_TOKEN`.
142166 *
167+ * ## Availability
168+ *
169+ * This feature is currently available in
170+ * [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access).
171+ * Please reach out to Auth0 support to get it enabled for your tenant.
172+ *
143173 * It will fail with [CredentialsManagerException] if the existing refresh_token is null or no longer valid.
144174 * This method will handle saving the refresh_token, if a new one is issued.
145175 */
@@ -157,6 +187,12 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
157187 * parameter with the session transfer token. For example,
158188 * `https://example.com/login?session_transfer_token=THE_TOKEN`.
159189 *
190+ * ## Availability
191+ *
192+ * This feature is currently available in
193+ * [Early Access](https://auth0.com/docs/troubleshoot/product-lifecycle/product-release-stages#early-access).
194+ * Please reach out to Auth0 support to get it enabled for your tenant.
195+ *
160196 * It will fail with [CredentialsManagerException] if the existing refresh_token is null or no longer valid.
161197 * This method will handle saving the refresh_token, if a new one is issued.
162198 */
@@ -499,6 +535,20 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
499535 exception, error
500536 )
501537 )
538+ } catch (exception: RuntimeException ) {
539+ /* *
540+ * Catching any unexpected runtime errors in the token renewal flow
541+ */
542+ Log .e(
543+ TAG ,
544+ " Caught unexpected exceptions for token renewal ${exception.stackTraceToString()} "
545+ )
546+ callback.onFailure(
547+ CredentialsManagerException (
548+ CredentialsManagerException .Code .UNKNOWN_ERROR ,
549+ exception
550+ )
551+ )
502552 }
503553 }
504554 }
@@ -684,5 +734,6 @@ public class CredentialsManager @VisibleForTesting(otherwise = VisibleForTesting
684734 // This is no longer used as we get the credentials expiry from the access token only,
685735 // but we still store it so users can rollback to versions where it is required.
686736 private const val LEGACY_KEY_CACHE_EXPIRES_AT = " com.auth0.cache_expires_at"
737+ private val TAG = CredentialsManager ::class .java.simpleName
687738 }
688739}
0 commit comments