add http-api

This commit is contained in:
2025-03-20 17:48:37 -03:00
parent a41f90f3a9
commit 85cbc9269c
25 changed files with 1726 additions and 0 deletions

8
http-api/cognito.py Normal file
View File

@@ -0,0 +1,8 @@
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
else:
return {attr['Name']: attr['Value'] for attr in user['UserAttributes']}