Swift - Firebase Auth with Microsoft Graph (Redirect URL Problem)

烂漫一生 提交于 2021-02-10 20:37:53

问题


I'm having a problem integrating Firebase with Microsoft Auth in my iOS App.

The login page has been launched and I can sign in by Office365 account but login auth can not be finished because of the below Error :

"AADSTS50011: The reply url specified in the request does not match the reply urls configured for the application:[app-id]"

I did check the setting in Firebase and below are the settings I add in the app of Azure Active Directory :

  1. Web redirect URL : "*.firebaseapp.com/__/auth/handler"
  2. Supported account types : "Accounts in any organizational directory (Any Azure AD directory Multitenant)"

Here are the swift code I implement :

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

Does anyone know how to solve the problem or have the same problem?


回答1:


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

Have you replaced * with your projectName? You can find your Authorized Domain under Authorized Domains in firebase console. The redirect uri should be something like

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


来源:https://stackoverflow.com/questions/57816895/swift-firebase-auth-with-microsoft-graph-redirect-url-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!