ios - Swift - Firebase Auth with Microsoft Graph(重定向 URL 问题)

标签 ios swift firebase firebase-authentication azure-active-directory

我在我的 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 应用程序中添加的设置:

  1. Web 重定向 URL:“*.firebaseapp.com/__/auth/handler”
  2. 支持的帐户类型:“任何组织目录中的帐户(任何 Azure AD 目录 Multi-Tenancy )”

这是我实现的 swift 代码:

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)
            }
        }
    }
}   

有谁知道如何解决这个问题或者有同样的问题吗?

最佳答案

When registering apps with these providers, be sure to register the *.firebaseapp.com domain for your project as the redirect domain for your app.

您是否已将 * 替换为您的项目名称?您可以在 firebase 控制台的 Authorized Domains 下找到您的授权域。重定向 uri 应该类似于

https://yourFirebaseApp.firebaseapp.com/__/auth/handler

关于ios - Swift - Firebase Auth with Microsoft Graph(重定向 URL 问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57816895/

相关文章:

ios - 错误 : "Invalid data message - all must be length: 8" - PickerIOS

ios - 在 iOS 上解码 Base64 数据

swift - 如何快速将 Int32 值转换为 CGFloat?

android - notifyItemInserted 贵吗

ios - 使用 swift 3 解码字符串

Javascript 错误未捕获的异常

swift - Prepareforsegue 没有将适当的值传递给目标 Viewcontroller?

swift - 从未使用过变量的初始化

java - Android 推送通知 Firebase

javascript - 如何在 firebase 中创建另一个唯一的用户 id?