Ionic Framework and Firebase v3 auth error: This domain is not authorized for OAuth operations for your Firebase project

I’m trying to implement facebook/twitter/google+ autentication using Firebase v3 in my Ionic1 app, it works fine in the browser but it gives me this error on real devices (Android/iOS):

This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.

I think the problem is that I need to add my app’s domain in the “OAuth redirect domains” section in Firebase, but I don’t know which is my app’s domain when running on a device.

  • document.location.host and window.location.host are blank

Someone knows how to solve this problem?

Here you can find the same question on SO:

Thanks in advance

I am having the same problem. Did you solve it?

I’ve not found a way to whitelist my Ionic app.

As a guy suggested in a StackOverflow response, signInWithCredential works, but you need to get an OAuth token using an OAuth library/plugin like ngCordovaOAuth or cordova-plugin-facebook4/twitter-connect-plugin.

Here’s an example
var credential = firebase.auth. FacebookAuthProvider.credential(YOUR_FACEBOOK_TOKEN) firebase.auth().signInWIthCredential(credential)

I got it to work by updating everything and it no longer warns me about authorization.

Here is the doc to update to the new version completely.

https://firebase.google.com/support/guides/firebase-web

2 Likes

I already updated and using the latest Firebase 3 but I still get that error. Any idea suggestions ?

Library i am using is: 3.0.3 : https://www.gstatic.com/firebasejs/3.0.3/firebase.js
I am using the signInWithPopup method.

Thanks

signInWIthPopup/signInWithRedirect are not supported at the moment.

You should get use a plugin to get the credential and use them to autenticate using signInWithCredential

https://groups.google.com/forum/#!topic/firebase-talk/mC_MlLNCWnI

@MisterDev Is it possible to share a small snippet on how you’re using signInWithCredential ? Thank you lots !

http://www.clearlyinnovative.com/firebase-3-0-ionic-facebook-login

3 Likes

You can also use:

Hi all,

I guess the issue i’m having is related to this but I’d like to confirm.

When using the signInWIthCredential method the InAppBrowser instance kind of initiates but it quickly closes not finishing the OAuth process.

Is it related to the same issue you guys are having or it might be another one ?

I’m asking this because I’m considering use the same workaround proposed here.

Thanks.

updated sample using AngularFire2 with Ionic2 and Facebook Auth

does it also work with email auth?

yes it does work with email auth

1 Like

You can check my example! :smiley:

Regards, Nicholls

How would this apply to Ionic 2?

Your code was a great reference, however the error is still there, what is the relevant code in the solution that gets rid of it?

The problem seems to be related to the fact that the app running on the android device with the --livereload option uses http to get the page served from the dev computer’s ionic own web/app server (CLI), this causes the message from the Firebase server, when running the app in production mode (from the device and not the dev server, as ionic run without the --livereload option would do) the origin becomes file:// and the problem disappears if you followed the instructions above )

Note: My case is somewhat simpler, since I am not using facebook or google auth at the moment, however if there was a way to remove the error that would be really nice.

it will not work with the live reload flag set. if your issue is something else, please provide additional details.

1 Like