尝试通过 django 中的 microsoft allauth 回调中的第三方帐户登录时发生错误

问题描述 投票:0回答:1

此处提供了 Microsoft 的所有身份验证设置。 登录microsoft后,认证成功,得到200。

记录如下:

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

最后页面显示错误

第三方登录失败 尝试通过您的第三方帐户登录时发生错误。

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',

            }
        ]
    }
}

身份验证和 azure 目录配置良好,django allauth 的回调端没有可用的错误描述。 我发现同样的方法在这里也适用 - https://allauth.org/ 但这个页面没有具体的描述。

认证成功后回调函数不起作用。

django authentication azure-active-directory allauth django-microsoft-authentication
1个回答
0
投票

将 SCOPE 中的“个人资料”替换为“User.Read”

© www.soinside.com 2019 - 2024. All rights reserved.