Skip to content

Commit

Permalink
Add AzureADOauth2 backend using the v2.0 API.
Browse files Browse the repository at this point in the history
AzureADOAuth2 uses the v1.0 API which doesn't support personal accounts.
Updating the endpoints used by the original class may break backward
compatibility, so add this as just an additional subclass.
  • Loading branch information
mateuszmandera committed Aug 22, 2024
1 parent 5899cb9 commit 5af9efa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions social_core/backends/azuread.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,13 @@ def get_auth_token(self, user_id):
new_token_response = self.refresh_token(token=access_token)
access_token = new_token_response["access_token"]
return access_token

class AzureADOAuth2V2(AzureADOAuth2):

Check failure on line 149 in social_core/backends/azuread.py

View workflow job for this annotation

GitHub Actions / flake8

expected 2 blank lines, found 1
""" Version of the AzureADOAuth2 backend that uses the v2.0 API endpoints,
supporting users with personal Microsoft accounts, if the app settings
allow them. """

name = "azuread-oauth2-v2"
AUTHORIZATION_URL = "{base_url}/oauth2/v2.0/authorize"
ACCESS_TOKEN_URL = "{base_url}/oauth2/v2.0/token"
DEFAULT_SCOPE = ["User.Read profile openid email"]

0 comments on commit 5af9efa

Please sign in to comment.