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
I also ran in to this issue. I use the angularfire2 and firebase npm package in my ionic2 project.
At first, I had no problems. But when I did a upgrade of all of my npm packages (upgrade ionic to 2.3.0, angular to 2.4.8 and angularfire2 to 2.0.0 beta, in my case), the error appeared. I can click it away, so it's not blocking (but very anoying!).
It's only visible when I run ionic serve in the browser (and not in the ionic view app for example):
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)
solution:
- remove the build folder
- do a new ionic build ios command
- and run the app again with ionic serve
Now the network error is away
I faced the similar problem: everything alright on the browser but not in android.
I follow this steps: https://github.com/angular/angularfire2/blob/master/docs/Auth-with-Ionic3-Angular4.md
then I changed:
in package.json: "firebase": "^3.6.6", "angularfire2": "^4.0.0-rc0",
In my case, I'm using lazy loading so I imported the modules in my pages (e.g.: login.module.ts) import { AngularFireModule } from 'angularfire2'; import { AngularFireDatabaseModule } from 'angularfire2/database'; import { AngularFireAuthModule } from 'angularfire2/auth'; .... imports: [ IonicPageModule.forChild(LoginPage), TranslateModule, AngularFireModule, AngularFireDatabaseModule, AngularFireAuthModule ],
That works for me.
EDIT2: I have found the problem that's causing it. I am hosting my app on firebase hosting and wrote my rewrite rules to redirect if a file or folder does not exist to index.html. After removing the rewrite it works everytime. Altough i can't find how to not apply this rule to https://barqueue.firebaseapp.com/__/auth/. If anyone got any suggestions I would love to hear them.
~~EDIT: This only works half of the time. On edge on the other hand it seems to work always. I'm not using ionic. It's just a pwa.
Had the same issue. The login click handler was on a md-button without defining type. By setting type="button" this error resolved itself. The weird thing is this only happened in chrome all other browsers worked perfectly. I assume that only chrome sets the default button type to submit. Hope this helps anybody.
My solution: Set button type to "button"~~
SOLVED
- Install
whitelistcordova plugin
ionic cordova plugin add cordova-plugin-whitelist
- Add
allow-navigationfor all inconfig.xml
<allow-navigation href="*" />
That's it! Works fine for me