Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix/cannot login when token is deleted #950

Merged
merged 10 commits into from
Apr 5, 2024

Conversation

KhaledNjim
Copy link
Collaborator

Description

gitlab ticket

When the permanent token is deleted from the web, the app gets stuck loading

Root cause

when the permanent token is deleted the RetryAuthenticationInterceptors fails to get a new token and throws an unhandled exception causing the app to get stuck loading

Solution

  • wrapping the code in the interceptor in try catch block
  • logout the user locally to prevent the account from getting locked

@@ -103,6 +104,11 @@ class AuthenticationDataSourceImpl implements AuthenticationDataSource {
return userRes.toUser();
}).catchError((error) {
_remoteExceptionThrower.throwRemoteException(error, handler: (DioError error) {
final errorCode = error.response?.headers.value(Constant.linShareAuthErrorCode) ?? '1';
final authErrorCode = LinShareErrorCode(int.tryParse(errorCode) ?? 1);
if(authErrorCode.value==1000){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please dont use magic number. constant 1000 in value

@hoangdat hoangdat merged commit 9eefacc into master Apr 5, 2024
4 checks passed
@hoangdat hoangdat deleted the bugFix/cannot_login_when_token_is_deleted branch April 5, 2024 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants