diff --git a/social_core/backends/azuread.py b/social_core/backends/azuread.py index 837d2c54..528c25ff 100644 --- a/social_core/backends/azuread.py +++ b/social_core/backends/azuread.py @@ -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): + """ 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"]