auth0 / Auth0.Android

Android toolkit for Auth0 API
https://auth0.com
MIT License
216 stars 133 forks source link

Return refreshed Credentials in CredentialsManagerException to avoid logout #666

Closed poovamraj closed 1 year ago

poovamraj commented 1 year ago

Changes

To avoid Logout because of not storing the refreshed credentials. We are providing the Credentials back to the user through our Exception.

Since Exceptions are highly logged we are masking sensitive data from it to avoid exposing them.

References

https://github.com/auth0/Auth0.Android/issues/661

Testing

bennycao commented 1 year ago

Hi @poovamraj , just want to understand what it means by the comment here https://github.com/auth0/Auth0.Android/blob/main/auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.kt#L191C51-L191C51

it says clearcredentials so hasValidCredentials returns a true value. Doesn't clearing credentials mean hasValidCredentials will return false. And does the retry statement mean retrying of saveCredentials or something else ? It would be good to understand what the comment is referring too, and not go down this path if re-saving refreshed credentials won't help

poovamraj commented 1 year ago

@bennycao the comment is mentioned to note why we are calling the clearCredentials method. It is done so that hasValidCredentials won't return true when we can't fetch valid credentials due to corrupted keys.