【发布时间】:2019-09-06 06:37:52
【问题描述】:
我在 iOS 应用中将 Firebase 与 Microsoft Auth 集成时遇到问题。
登录页面已启动,我可以使用Office365帐户登录,但由于以下错误无法完成登录验证:
"AADSTS50011: The reply url specified in the request does not match the reply urls configured for the application:[app-id]"
我确实检查了 Firebase 中的设置,以下是我在 Azure Active Directory 的应用程序中添加的设置:
- 网页重定向网址:“*.firebaseapp.com/__/auth/handler”
- 支持的帐户类型:“任何组织目录中的帐户(任何 Azure AD 目录多租户)”
这是我实现的快速代码:
provider = OAuthProvider(providerID: "microsoft.com")
provider?.customParameters = ["prompt": "consent",
"login_hint": "Login Hint"]
provider?.scopes = ["mail.read", "calendars.read"]
provider?.getCredentialWith(_: nil){ (credential, error) in
if let credential = credential {
Auth.auth().signIn(with: credential) { (authResult, error) in
if let error = error {
print(error.localizedDescription)
}
}
}
}
有没有人知道如何解决这个问题或遇到同样的问题?
【问题讨论】:
-
与您的回复 URL 问题无关(您已经在下面得到了答案):您应该不包含
prompt=consent自定义参数。这会给您的应用程序带来问题。 -
@PhilippeSignoret 如果我包含
prompt=consent会导致什么样的问题? (例如,强制用户提供同意?) -
在许多组织中,不允许用户同意。在这些组织中,管理员将代表所有用户同意。但即使管理员已经代表所有用户同意,如果您强制同意
prompt=consent用户将被阻止(因为不允许他们同意,并且您的应用程序会强制他们重新同意)。只有当您确定您的应用所需的权限尚未被授予时,您才应该使用prompt=consent。 -
@PhilippeSignoret 已注意,以后使用时会小心!!非常感谢你提醒我。
标签: ios swift firebase firebase-authentication azure-active-directory