Skip to content

Commit

Permalink
authn: Handle case when a user is not in any group
Browse files Browse the repository at this point in the history
In this case, the "cognito:groups" claim does not exist. Previously,
this resulted in a KeyError upon login and whoami commands.
  • Loading branch information
victorlin committed Oct 3, 2023
1 parent 32540a9 commit 1ccbed2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nextstrain/cli/authn.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, session: cognito.Session):
assert session.id_claims

self.username = session.id_claims["cognito:username"]
self.groups = session.id_claims["cognito:groups"]
self.groups = session.id_claims.get("cognito:groups", "")
self.email = session.id_claims["email"]

self.http_authorization = f"Bearer {session.id_token}"
Expand Down

0 comments on commit 1ccbed2

Please sign in to comment.