Skip to content

Commit

Permalink
[oar/api/frontend] fix whoami crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
adfaure committed Nov 22, 2023
1 parent f78e508 commit 9667cd2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions oar/api/routers/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ def version():


@router.get("/whoami")
def whoami(user: str = Depends(get_token_data)):
def whoami(data: str = Depends(get_token_data)):
"""Give the name of the authenticated user seen by OAR API.
The name for a not authenticated user is the null string.
"""
return {"authenticated_user": user["user"]}
user = ""

if data:
user = data['user']

return {"authenticated_user": user}


@router.get("/check_token")
Expand Down

0 comments on commit 9667cd2

Please sign in to comment.