-
-
Save KyMidd/6627a988d66d6420a1f7619576136796 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): | |
| # Read table names from environment variables | |
| conversation_table_arn = os.environ.get("CONVERSATION_TABLE_ARN") | |
| token_table_arn = os.environ.get("TOKEN_TABLE_ARN") | |
| # Get the bot token and signing secret from AWS Secrets Manager | |
| # Fetch secret package | |
| secrets = get_secret_ssm_layer(bot_secret_name) | |
| # Disambiguate secrets | |
| secrets_json = json.loads(secrets) | |
| TENANT_ID = secrets_json["TENANT_ID"] | |
| CLIENT_ID = secrets_json["CLIENT_ID"] | |
| CLIENT_SECRET = secrets_json["CLIENT_SECRET"] | |
| # Now we can use the bot token and signing secret | |
| print("🟢 Successfully retrieved secrets from AWS Secrets Manager") | |
| # Exchange the authorization code for an access token | |
| token_response = exchange_code_for_token(auth_code, TENANT_ID, CLIENT_ID, CLIENT_SECRET) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment