My App uses the Firebase Auth SDK (10.4.0) to authenticate users with OAuth. In my project settings I enabled OpenID Connect as a Sign-In-Method. I use an education institute named "IServ" as my openid auth provider. They have provided me with the ClientID, Issuer-URL and the Client Secret which I entered in the firebase console. I am able to launch the login form of my provider in a WebView with the following code:
let oAuthProvider = OAuthProvider(providerID: "oidc.iserv")
oAuthProvider.scopes = ["roles"]
oAuthProvider.getCredentialWith(nil) { credential, error in
print(credential, error)
}
After entering the login information in the login form of my provider and pressing continue the browser strangely redirects to a white webpage and after a few seconds it redirects to "about:blank".
I have two iOS Apps that are both connected to the same Firebase project. In one of the two apps the oauth login is working and the user gets redirected to the app (i.e. the WebView closes automatically). But in my other app the redirect is not working, although its the exact same code.
I can’t retrieve any error in my Xcode console, nor in the WebView. Is this a common issue and has this something to do with the Xcode project setup?
I would really appreciate some help regarding this.
2
Answers
I had the same issues in a SwiftUI app, which I solved with the following approach.
Just before the
about:blank
is loaded, the app’s callbackonOpenURL
is called (it’s just the SwiftUI version ofUIApplicationDelegate application:openURL:options
).In the callback, add the following code that triggers the authentication flow continuation:
This did the trick, for AppDelegate add the following code