add apikey

This commit is contained in:
2025-03-27 01:14:18 -03:00
parent 7021833476
commit 8118dfd403
14 changed files with 114 additions and 69 deletions

View File

@@ -1,8 +1,11 @@
class UserNotFound(Exception): ...
def get_user(access_token: str, *, idp_client) -> dict | None:
"""Gets the user attributes and metadata for a user."""
try:
user = idp_client.get_user(AccessToken=access_token)
except idp_client.exceptions.ClientError:
return None
raise UserNotFound()
else:
return {attr['Name']: attr['Value'] for attr in user['UserAttributes']}