angularfire: 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?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 48 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Found the issue: https://firebase.google.com/docs/reference/js/firebase.auth.Auth#getRedirectResult

The error is listed on that page.

Auth is calling that method to see if the app is being loaded as an oauth redirect. We could add a protocol check before calling the method.

here is a project where I am running into issues - https://github.com/aaronksaunders/ionic2-angularfire-sample/tree/firebase3-support

Issue appears to be around anything that you need to subscrbe to, I am creating a very basic app to demonstrate the issue.

I am getting errors thrown around this.af.auth.subscribe()

I created a smaller project that shows the issue without all the extras: https://github.com/aaronksaunders/basicaf2

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.

@jeffbcross just checked it and it works

I got the same issue with Electron, Ionic 1 and Ionic 2.

@ciekawy i think that integrating it directly into angularfire2 is the wrong approach for mobile solutions, I believe the correct approach it to provide integration points, like they have and leave it at that…

I’ve published a preview of the changes I made in #271 to npm. Can folks here please npm install angularfire2@next and check that this issue is resolved?

Note: this has been published with the next tag on npm, so including the @next is required in order to install the correct version.

This issue also don’t allow to use Firebase authentication… It is really critical for my app. Any workarounds?