Runtime Error: A network error when login with facebook on web browser
Version info
Ionic Framework: 2.0.0 Ionic Native: 2.4.1 Ionic App Scripts: 1.0.0 Angular Core: 2.2.1 Angular Compiler CLI: 2.2.1 Node: 6.9.5 OS Platform: Windows 7 Navigator Platform: Win32 User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
How to reproduce these conditions
I setup following this link https://github.com/angular/angularfire2/blob/master/docs/Auth-with-Ionic2.md
Debug output
Error: Uncaught (in promise): Error: A network error (such as timeout, interrupted connection or unreachable host) has occurred. at s (http://localhost:8100/build/polyfills.js:3:4211) at s (http://localhost:8100/build/polyfills.js:3:4034) at http://localhost:8100/build/polyfills.js:3:4574 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723) at Object.onInvokeTask (http://localhost:8100/build/main.js:35843:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9659) at e.runTask (http://localhost:8100/build/polyfills.js:3:7083) at i (http://localhost:8100/build/polyfills.js:3:3671)
Actual behavior
The popup for facebook authentication is shown and disappeared shortly so i can't sign in.
Complete source code
https://drive.google.com/open?id=0B4dCHEToS7afNXM5WUN0ejlBMDA
Does this happen consistently?
yes, it does every time i try to click facebook login button. However the facebook login button works on android with some modification.
I am also facing the same issue on the android device. but not sure why it works properly when the device is connected with android studio.
Seems likely to be a whitelist step that's missing here. I remember this about Ionic with Firebase. @mukesh51 is this something you could look into?
I checked and tried all, actually not sure, why it works when the phone is connected with android studio.
it says the same error both facebook and google login, but sometimes work.
Created a new app following the tutorial, everything worked as expected with one exception.
I was getting an error in my console (firebase not found), when running the app in the android phone, so have to add the following line in my auth-service.ts
import * as firebase from 'firebase';
I did not have this error, when writing the original tutorial.
@bangive @sdey0081 : What errors are you getting on the console, when running the app in the android phone. Currently the tutorial displays the Facebook display name in the console. To view the console, when running your app on phone, you can use the following URL (chrome://inspect) on google chrome browser. This will connect your device and show your the console and errors if any. this is a brilliant tool to debug.
@bangive you said
The popup for facebook authentication is shown and disappeared shortly so i can't sign in.
Is it possible that you're already logged into you facebook account on your phone, which might cause this behaviour and which makes sense as well.
Also in the firebase console, when you enable your facebook sign-in authentication method, you need to provide your App Id and app secret, which I hope you're getting it from your App created under http://developers.facebook.com/apps.
you also need to add the add OAuth redirect URI to your Facebook app configuration, which is on the facebook dashboard page under Products -> Facebook Login --> Settings.. This is a key step for interaction between facebook and firebase. Everything is here
Let me know, if this helps..
@katowulf @davideast I'll update the tutorial to add these details and update the app to display the name on page itself, apart from displaying it in console.
Hi @mukesh51 , thanks for your kindness.
As I said, it sometimes works correctly, but sometimes not, I already set both facbook and google authentication on their dashboard. Only fired at the firebase. Here is the error app says:
I also attached a video file here which says this more detail.
Regards.
Hi @sdey0081 I downloaded your code and ran it locally, Despite running it at least 7-8 times, i was unable to reproduce the network error issue. I did see your video as well, but unable to reproduce it locally. Did you see this behaviour only in browser or in Android phone as well.
I've created a test repo here . You can try downloading it and running it locally to see, if you see the same behaviour. Before running, update your credentials in app.module.ts.
okay, let me try again, but i didn't share my code yet.
There was repo at the start of this issue. Oops, it was from @bangive and it works for me.
Please share your repo as well and try mine.
@mukesh51 I download your test repo, run it in chrome in windows 7. The popup still shown and dissapeared shortly. Still cannot sign in. Here the error in console:
EXCEPTION: Uncaught (in promise): Error: A network error (such as timeout, interrupted connection or unreachable host) has occurred.
ErrorHandler.handleError @ main.js:52867
main.js:52872 ORIGINAL STACKTRACE:
ErrorHandler.handleError @ main.js:52872
main.js:52873 Error: Uncaught (in promise): Error: A network error (such as timeout, interrupted connection or unreachable host) has occurred.
at s (polyfills.js:3)
at s (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (main.js:36630)
at t.invokeTask (polyfills.js:3)
at e.runTask (polyfills.js:3)
at i (polyfills.js:3)
ErrorHandler.handleError @ main.js:52873
polyfills.js:3 Unhandled Promise rejection: A network error (such as timeout, interrupted connection or unreachable host) has occurred. ; Zone: angular ; Task: Promise.then ; Value: O undefined
o @ polyfills.js:3
polyfills.js:3 Error: Uncaught (in promise): Error: A network error (such as timeout, interrupted connection or unreachable host) has occurred.
at s (polyfills.js:3)
at s (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (main.js:36630)
at t.invokeTask (polyfills.js:3)
at e.runTask (polyfills.js:3)
at i (polyfills.js:3)
o @ polyfills.js:3
polyfills.js:3 Uncaught Error: Network Error
at http://localhost:8100/build/main.js:101979:31
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723)
at e.runTask (http://localhost:8100/build/polyfills.js:3:7083)
at invoke (http://localhost:8100/build/polyfills.js:3:10836)
at e.args.(anonymous function) (http://localhost:8100/build/polyfills.js:2:30123)
Hi @mukesh51 , test project works without any issues now(both browser and device), and committed on this repo, just checking the issue I mentioned first on the other side.
@sdey0081 Glad it worked for you, but still a problem for @bangive.
Unfortunately unable to reproduce at my end, despite downloading @bangive repo. Need to dig more. @bangive apart from enabling the facebook authentication in Firebase console, what are the domains you see on the same page below.
Once you get an error and if you try to refresh the page, what do you get.
Also seems like this issue is being reported here and seems to be in various forums in stackoverflow.
Could you please confirm, that your settings on facebook page are correct, as mentioned above. I suspect there might be a missing bit, since the same test project worked for @sdey0081
I downloaded your test app, built in and tested facebook sign-in in a browser and on a nexus 5x device successfully.
Here is the settings on facebook page by image:

I forgot to say that i am testing on localhost
@bangive so is it working now.
no, it is not working
In the facebook dashboard page, when you click settings and under Basic tab, you should see your App ID and App Secret.
On the same page below, you need to add your platform (let's say Android in this case) and update the Google Play Package Name with the Widget Id from config.xml.
Something like this
<widget id="com.ionicframework.yourAppName345871"
Hopefully, you've this entry in your dashboard.
Thank you for supporting, i have solved my problems. I deploy my ionic app to firebase hosting and go to facebook developer page and enable Web OAuth Login. The facebook login now works on real website but does not work on localhost.