Flask Dance OAuth通过Microsoft Azure错误

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

我正在测试一个Azure Web应用程序,该应用程序将使用Flask Dance通过其Microsoft帐户授权用户。我从Azure的文档中获取了代码:

blueprint = make_azure_blueprint(
    client_id="id_here",
    client_secret="secret_here")

app.register_blueprint(blueprint, url_prefix="/login")

@app.route('/')
def login():
    if not azure.authorized:
        return redirect(url_for("azure.login"))
        response = azure.get("/v1.0/me")
    assert resp.ok
    return "You are {mail} on Azure AD".format(mail=resp.json()["userPrincipalName"])

因此,当我运行它时,我得到登录屏幕,然后登录,但后来我收到此错误:

Sorry, but we’re having trouble signing you in.

AADSTS50011: No reply address is registered for the application.

根据错误,我相信我需要在某处设置我的本地主机,但我没有看到输入它的地方。此外,如果我只是转到页面的不同部分并绕过登录,即使我没有登录也能正常工作。

当我部署它时,我收到502错误,无法连接到它(它在我设置Azure蓝图部分之前工作)。

我错过了什么,我做错了什么?

在本页面:

https://platinumdogs.me/2016/04/25/understanding-the-oauth2-redirect_uri-and-azure-ad-reply-url-parameters/

它说我应该能够添加“登录URL”和“应用程序ID URI”,但我无法在任何地方找到这些字段。

azure flask oauth-2.0 azure-web-app-service
1个回答
2
投票

你应该读一下关于OAuth的东西,你可以启动here。至于错误,您似乎需要为Azure AD应用程序配置回复URL。

转到Azure AD刀片,打开应用程序,导航到您的应用程序。打开设置并配置回复网址。

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