Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hardikmashru committed Apr 22, 2024
1 parent 1e534c8 commit dd4492e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ public enum AuthFailureReason {
AUTH_TOKEN_PAYLOAD_INVALID,
AUTH_TOKEN_USER_KEY_INVALID,
AUTH_TOKEN_NULL,
AUTH_TOKEN_GENERATION_ERROR
AUTH_TOKEN_GENERATION_ERROR,
AUTH_TOKEN_MISSING,
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ void reSyncAuth() {
}

void handleAuthFailure(String authToken, AuthFailureReason failureReason) {
authHandler.onAuthFailure(new AuthFailure(getEmailOrUserId(), authToken, IterableUtil.currentTimeMillis(), failureReason));
if (authHandler != null) {
authHandler.onAuthFailure(new AuthFailure(getEmailOrUserId(), authToken, IterableUtil.currentTimeMillis(), failureReason));
}
}

private String getEmailOrUserId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ private static AuthFailureReason getMappedErrorCodeForMessage(JSONObject jsonRes
return AuthFailureReason.AUTH_TOKEN_INVALIDATED;
case "invalid payload":
return AuthFailureReason.AUTH_TOKEN_PAYLOAD_INVALID;
case "jwt authorization header is not set":
return AuthFailureReason.AUTH_TOKEN_MISSING;
default:
return null;
}
Expand Down

0 comments on commit dd4492e

Please sign in to comment.