Skip to content

Commit 0dc8d83

Browse files
kaushal-unifyfacebook-github-bot
authored andcommitted
{BugFix} mps_cli - Authentication - Handle Exception in case of invalid auth token
Summary: This change fix the issue when the user install aria studio but the token is invalid or expired in the saved cache. This diff is a bug fix for the authentication process in the Aria MPS CLI. The code changes in the authentication.py file handle exceptions in case of invalid auth tokens. The changes include catching exceptions such as ValueError, KeyError, OSError, and any other unexpected exceptions. If an exception occurs, the auth token cache file is removed and the function returns False. This ensures that the authentication process is not affected and the user is prompted to login again. Reviewed By: maieneuro Differential Revision: D78013372 fbshipit-source-id: c20fb91edc9f21fb4179c86761af1ea83782f25d
1 parent 9714e56 commit 0dc8d83

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

projectaria_tools/aria_mps_cli/cli_lib/authentication.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ async def load_and_validate_token(self) -> bool:
192192
return True
193193
except (ValueError, KeyError, OSError) as e:
194194
logger.error(f"Token loading failed: {e}")
195+
AUTH_TOKEN_FILE.unlink(missing_ok=True)
196+
return False
197+
except Exception as e:
198+
logger.error(f"Unexpected error while loading token: {e}")
199+
# removing the auth token cache file
200+
AUTH_TOKEN_FILE.unlink(missing_ok=True)
195201
return False
196202

197203
def get_encryption_key(self) -> bytes:

0 commit comments

Comments
 (0)