-
-
Save KyMidd/fbb0d96e38c18e92d2222763f88488d9 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 exchange_code_for_token(auth_code, tenant_id, client_id, client_secret): | |
| token_url = f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token" | |
| data = { | |
| "client_id": client_id, | |
| "client_secret": client_secret, | |
| "scope": "https://graph.microsoft.com/.default", | |
| "code": auth_code, | |
| "redirect_uri": f"{redirect_function_url}/callback", | |
| "grant_type": "authorization_code", | |
| } | |
| response = requests.post(token_url, data=data) | |
| response.raise_for_status() | |
| return response.json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment