An error occurred while attempting to login via your third-party account in microsoft allauth callback in django

The all auth settins for microsoft is provided here. The authedication is success and getting 200 after microsoft login.

log below:

Starting new HTTPS connection (1): login.microsoftonline.com:443
https://login.microsoftonline.com:443 "POST /common/oauth2/v2.0/token HTTP/11" 401 623 - here i am getting error

[03/Sep/2024 11:44:38] "GET /accounts/microsoft/login/callback/?code=M.C532_BL2.2.U.aec38xxxxxxx0f2ee&state=fi0hMAxxxxU2K HTTP/1.1" 200 1119

Finally page show error

Third-Party Login Failure An error occurred while attempting to login via your third-party account.

SOCIALACCOUNT_PROVIDERS = {
    "microsoft": {
        "APPS": [
            {
            'client_id': '14bb4',
            'secret': 'ed91f8adc68',
            "settings": {
                "tenant": "consumers",
                "login_url": "https://login.microsoftonline.com",
                "graph_url": "https://graph.microsoft.com",
            },
            'SCOPE': [
                'openid',
                'profile',
                'email',
            ],
            'AUTH_PARAMS': {
                'response_type': 'code',
            },
            'OAUTH_PKCE_ENABLED': True,
            'TENANT': 'common',
            'LOGIN_URL': 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
            'TOKEN_URL': 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
            'GRAPH_URL': 'https://graph.microsoft.com',

            }
        ]
    }
}

The authendication and azure directry configuration is fine, no error description is available on the call back side from django allauth. i found that the same will work here - https://allauth.org/ but there is no specific description in this page.

The callback function is not working after authentication success.

Back to Top