Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

firebase social login not redirected to the app , ionic 3 , ios

I am trying to implement social login in my ionic 3 app with the help of 'firebase' authentication. I followed this artical https://javebratt.com/ionic-social-login-firebase/

I installed all the plugins(cordova-plugin-browsertab,cordova-plugin-inappbrowser ..etc) and did exactly same as in the article.

Then I ran the app on both android and ios devices. in android device the facebook/google login page is opened in the 'in app browser' and it is redirected to the app successfully after the login process.everything works fine.

But in the iPhone the facebook/google login pages are opened in a new safari browser instance and after the login it redirect to localhost, and it is not redirected back to the application.

can anyone help me with this?

thank you

like image 246
SNT93 Avatar asked Jan 18 '18 05:01

SNT93


3 Answers

I believe the issue is related to ionic in iOS now defaulting to WKWebView (http://ionicframework.com/docs/wkwebview/) which has issues with Firebase. ionic native app URLs in iOS now appear as http://localhost instead of file://assets/.../index.html.

The suggested workaround at this time is to downgrade to UIWebView. Firebase Auth is looking into a solution for this.

like image 112
bojeil Avatar answered Oct 08 '22 17:10

bojeil


I had the same issue, and changing the webview engine didn't solve it for me.

What worked for me was to add

<allow-navigation href="http://*" />

to config.xml.

I guess this worked for me because that localhost:8080/... link works over http, but I only had https://* allowed in my config.xml before that.

Not sure though why this is not an issue on Android, but hope this helps!

like image 28
Eric Gopak Avatar answered Oct 08 '22 18:10

Eric Gopak


I have the same issue. I have followed all the steps described in https://firebase.google.com/docs/auth/web/cordova?authuser=2 but in ios it does not work (in Android all is working fine). I think it is related with the 'customurlscheme' property because this is the property that contains the app name that has to be reopened, but I have checked all the places where I am using it and all seems to be correct (I modified the package name of my app and I think this could be related with the issue).

I will try to fix it, if I find the solution I will let you know.

like image 22
Francisco Porcel Avatar answered Oct 08 '22 18:10

Francisco Porcel