Uncaught Error: "location.protocol" must be http or https when building to device using Ionic 2 & Angular 2
Error in question:
This operation is not supported in the environment this application is running on. "location.protocol" must be http or https.
This error only occurs when the app is built & running on a device. In the browser it works great (which is logical).
Maybe there's a way to manually set the location.protocol on a cordova app using Ionic 2?
I got the same issue with Electron, Ionic 1 and Ionic 2.
Still having issues in Ionic 2.
Seems like a serious ongoing issue, have been in love with the library as I've been working with it but it's sad that we can't use it in Electron or Ionic 2 style apps.
do we have a fix for this yet? thanks!
anybody to solved this issue?
@jeffbcross any updates for this issue?
Just tested on latest angularfire2, Still it is not posible to use Firebase3 Auth with angularfire2 on ionic 2 Got This operation is not supported in the environment this application is running on. \"location.protocol\" must be http or https and web storage must be enabled.
using angularfire2@next ([email protected] )
@jeffbcross @davideast should I create new issue or this one could be re-opened?
Hi Folks. This is an issue with the Firebase SDK and how it handles location. It's also, to some extent, a limitation as browsers sandbox local (i.e. file://) resources. Thus, handling Ionic's implementation would require an Ionic-specific SDK, or at lest some sort of adapter specifically to address this.
So, long story short: It's complicated and it's not in AngularFire's purview to solve this. With that in mind, I'm locking this thread to prevent further "is this fixed yet" questions.
For quick reference, here are the key discussions from this thread and possible solutions:
@olostan correctly suggests that some of the auth problems can by bypassed by using nraboy/ng2-cordova-auth and then calling signInWithCredential() as shown in this example.
@jlzuarezs correctly points out that one can bypass some of the redirect issues and auth methods by calling the OAuth methods directly as described here
@aaronksaunders suggests aaronksaunders/basicaf2
@harpreet2602 suggests rodrigoreal/ionic2-angularfire-login