Flask Dance OAuth via Microsoft Azure errors



我正在测试一个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",但我在任何地方都找不到这些字段。

你应该阅读一些关于OAuth的东西,你可以从这里开始。至于错误,您似乎需要为 Azure AD 应用程序配置回复 URL。

转到"Azure AD"边栏选项卡,打开"应用程序",导航到你的应用程序。打开设置并配置回复 URL。

最新更新