add http-api
This commit is contained in:
8
http-api/cognito.py
Normal file
8
http-api/cognito.py
Normal 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']}
|
||||
Reference in New Issue
Block a user