Firebase-ios-sdk: Firebase Auth with Microsoft (Azure AD) - Login not possible - "Unable to process request due to missing initial state"

Created on 13 Dec 2020  路  5Comments  路  Source: firebase/firebase-ios-sdk

[REQUIRED] Step 1: Describe your environment

  • Xcode version: XCode 12.2 (12B45b)
  • Firebase SDK version: 7.3.0
  • Installation method: CocoaPods
  • Firebase Component: Auth

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

When logging in to Firebase with Microsofts Azure AD as an authentication service by using provider.getCredentialWith(_: nil) I am able to open the Microsoft login page.
After entering the correct email + password then the following error appears inside the In-App-Browser:
"Unable to process request due to missing initial state. This may happen if browser sessionStorage is inaccessible or accidentally cleared."

  • The problem appears no matter if I set Chrome or Safari as a standard browser in iOS settings.
  • It happens on real devices (iPhone and iPad, iOS 14.2/14.3 and others), but not every user is affected. Most users can login without any problems.
  • I can't determine in what kind of circumstances the problem occurs, but on a device where the problem occurs, it is always reproducable.

What did work for me as a workaround:
In my completion handler of provider.getCredentialWith(_: nil) I call the same function with a delay of 1second again if an error was thrown. On the second run it always succeeds and gives me the credentials back.

Relevant Code:

                        provider.getCredentialWith(_: nil){credential, error in
                            if error != nil {
                                self.errorText = "Error"
                                return
                            }
                            if let credential = credential {
                                firebaseSignIn(credential: credential)
                            }
                        }
auth

Most helpful comment

same issue for google sign in on web

All 5 comments

Same issue :(

Same issue

same issue

same issue for google sign in on web

Same issue. Please fix, we want to use Firebase for auth but this is making it very difficult 馃サ

Was this page helpful?
0 / 5 - 0 ratings