-
-
Save KyMidd/c153a02ec89900e532e33fad002afc6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def handle_auth_code_callback(body, event, auth_code, aad_object_id): | |
| # ... | |
| encrypted_token_base64 = base64.b64encode(encrypted_token['CiphertextBlob']).decode('utf-8') | |
| # Store the access token in DynamoDB, can be used in future transactions for an hour (default expiration) | |
| dynamodb_client = boto3.client("dynamodb") | |
| dynamodb_client.put_item( | |
| TableName=token_table_arn, | |
| Item={ | |
| "aadObjectId": {"S": aad_object_id}, | |
| "accessToken": {"S": encrypted_token_base64}, | |
| "expiresAt": {"N": str(expires_at)} | |
| } | |
| ) | |
| print("🟢 Successfully stored access token in DynamoDB") | |
| # Fetch the conversation body from DynamoDB | |
| response = dynamodb_client.get_item( | |
| TableName=conversation_table_arn, | |
| Key={ | |
| "aadObjectId": {"S": aad_object_id} | |
| } | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment