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

3,506 views
Skip to first unread message

Devid Farinelli

unread,
Jun 1, 2016, 10:59:40 AM6/1/16
to Firebase Google Group

I'm trying to implement facebook/twitter/google+ authentication 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 my app doesn't have a domain when running on a device. (document.location.host and window.location.host are blank)


Is there a way to solve this problem?


Thanks in advance

boj...@google.com

unread,
Jun 1, 2016, 1:22:58 PM6/1/16
to Firebase Google Group
Hey Devid,
The error you are getting is associated with signInWithPopup and redirect. Those 2 operations are currently not yet supported in Cordova/Ionic frameworks for reasons you described.
We will work on a more graceful fail for these operations for now. In the meantime, you can call native SDKs of Google, Facebook and then retrieve the OAuth credential and call signInWithCredential to sign in to Firebase with the credentials retrieved.

Tony Awad

unread,
Jun 3, 2016, 5:32:06 PM6/3/16
to Firebase Google Group
Can you plesae provide us a timeline on when this will be completed ? 

Thanks

boj...@google.com

unread,
Jun 3, 2016, 6:41:44 PM6/3/16
to Firebase Google Group
Hey Tony, I can tell you we are working on it but we can't provide an exact timeline at this point. For now, use plugins to get the OAuth access tokens and then use signInWithCredential to sign in Firebase users.

Tony Awad

unread,
Jun 4, 2016, 2:23:24 AM6/4/16
to Firebase Google Group
Do you think going back to Firebase 2 is an option for now ? 
Thanks again.


On Wednesday, 1 June 2016 13:22:58 UTC-4, boj...@google.com wrote:

Aaron Saunders

unread,
Jun 4, 2016, 2:24:58 AM6/4/16
to Firebase Google Group
I have a solution for the Facebook login here, but still seeing the auth error - Firebase 3.0 Ionic & Facebook Login http://bit.ly/1TTJuAs

boj...@google.com

unread,
Jun 4, 2016, 3:38:09 AM6/4/16
to Firebase Google Group
To suppress the error until a long term solution is available, do not pass the authDomain field in your app configuration.

Tony Awad

unread,
Jun 10, 2016, 4:39:56 PM6/10/16
to Firebase Google Group
Thanks for the suggestion Bassam. I am currently using that solution and it's working fine. If someone needs help with it let me know.

Bassam, can you update this thread when you have any news about this ?

Thanks

Bassam Ojeil

unread,
Jun 10, 2016, 5:18:20 PM6/10/16
to Firebase Google Group
I am glad it's working. We will keep you posted on any updates regarding this issue. 

Valentyn Shybanov

unread,
Jun 23, 2016, 1:07:06 PM6/23/16
to Firebase Google Group
Hi. 

When I've removed "authDomain" but now I have another error: 
"Error: Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console."

I am using sdk 3.0.5

Is there any workaround for this issue? For me it's really critical - logging with FB and Google accounts is mandatory part for my app... As I see, there are couple of workarounds (like using OpenFB) but not for Google accounts...

Thanks for any ideas! 

WBR,
Valentyn

субота, 4 червня 2016 р. 10:38:09 UTC+3 користувач Bassam Ojeil написав:

Bassam Ojeil

unread,
Jun 23, 2016, 1:40:10 PM6/23/16
to Firebase Google Group
Hey Valentyn, with 3.0.5 you can keep authDomain. It shouldn't trigger the breaking error anymore.
That said, signInWithPopup, signInWithRedirect and their link counterparts are currently not supported in native Ionic/Cordova apps. We are working on supporting that.
In the meantime, if you wish to use an equivalent method for sign in, you have to use some cordova plugin for signing in to Google or Facebook. Using the OAuth access token returned, you can then sign in to Firebase using:
auth.signInWithCredential(firebase.auth.FacebookAuthProvider.credential(fbAccessToken));
One example of a plugin for facebook sign in: https://www.npmjs.com/package/cordova-plugin-facebook
Hopefully this answers you question.

Bassam

Jeremy

unread,
Jul 1, 2016, 10:55:15 AM7/1/16
to Firebase Google Group
I was having the same issue and resolved it with the help of Bassam's suggestion.  I am using Firebase 3 and angularfire with Ionic.  I found a cordova plugin called cordova-plugin-facebook4.  This is the code sniper that I use for the Facebook login method:

var auth = $firebaseAuth();
facebookConnectPlugin
.login(['email','public_profile','user_friends'], //first argument is an array of scope permissions
                   
function(result){
                        console
.log('logged into facebook');
auth
.$signInWithCredential(firebase.auth.FacebookAuthProvider.credential(result.authResponse.accessToken)).then(
                           
function(succes){
                                console
.log('Firebase Facebook login success');
                           
},
                           
function(error){
                               console
.log(error);
                           
});
                   
},
                   
function(error){
                        console
.log(error);
                   
}
               
)


Hope this helps someone.  The cordova-plugin-facebook4 plugin makes a very elegant login flow.


On Wednesday, June 1, 2016 at 10:59:40 AM UTC-4, Devid Farinelli wrote:

Taige

unread,
Jul 6, 2016, 5:32:12 PM7/6/16
to Firebase Google Group
Thanks! I'll try it tomorrow. Glad I found this thread and someone asked the question. It's really confusing when the error is "This domain is not authorized for OAuth operations for your Firebase project" so I was trying to figure out how to whitelist it for some time.

I following the directions here and when I deployed to devices it didn't work. It mentioned for apps, redirect is the preferred method, so it's strange that here Bassam says, Cordova is not supported.

I also found this which seems to do the trick too.
Message has been deleted

Taige

unread,
Jul 7, 2016, 9:00:00 PM7/7/16
to Firebase Google Group
@Jeremy - I can't seem to get it to work. I installed the cordova-plugin-facebook4 plugin using the cordova command and added the <div id="fb-root"></div> in the index.html. Is there anything else I need to do? I get "facebookConnectPlugin is not defined". 


On Friday, July 1, 2016 at 4:55:15 PM UTC+2, Jeremy wrote:

Tony Awad

unread,
Jul 8, 2016, 10:27:05 AM7/8/16
to Firebase Google Group
Hi Taige,

I saw your message recently. What I ended up using for facebook is https://github.com/nraboy/ng2-cordova-oauth and I am currently using it with Firebase 3. It works great. They have quite good documentation on github but let me know if you need clarifications or help with it.

Good luck.
Tony

Taige

unread,
Jul 8, 2016, 1:08:45 PM7/8/16
to Firebase Google Group
Thanks for your suggestion. I'll check it out, but I've already gone back to Firebase 2. I hope they add the support soon. For now, it's fine since I don't need Firebase 3 functionality right now anyway. 

Missak Boyajian

unread,
Jul 28, 2016, 5:33:13 PM7/28/16
to Firebase Google Group
Hey, I have the same problem, can you show me a sample code if it is possible of how you did it ?

Sagar Manohar

unread,
Aug 4, 2016, 11:57:13 AM8/4/16
to Firebase Google Group
Hi Bassam, Any rough estimate when will this functionality be incorporated? This month? Next three months? By end of year? Any estimate would help. Thank you!

Kato Richardson

unread,
Aug 4, 2016, 2:20:23 PM8/4/16
to Firebase Google Group
Hi Sagar,

No ballparks or public release dates we can share. Sorry.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/0deadd9b-43c2-467d-a807-08a87eeef615%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Tony BenBrahim

unread,
Oct 28, 2016, 10:52:51 AM10/28/16
to Firebase Google Group
While this solution works now, it will stop working for Google login when Google deprecates OAuth from webviews as described here (and here where it will stop working). As far as I am concerned, ionic + Firebase cannot be used if you need Google login (from a Google for Work domain) that will not break in a few weeks or months...
Oh well, an excuse to learn native Android development....

Bassam

unread,
Oct 28, 2016, 2:30:03 PM10/28/16
to Firebase Google Group
Hey Tony and Cordova/Ionic developers,
Sorry for the delay. We understand your concerns. We are working on a solution which will not use embedded webviews for Google OAuth. It should be ready way before the April 20, 2017 date (date when Google will block webview OAuth implementations).
This is a top priority for us.

Thank you for your understanding and patience.
Best regards,
Bassam

Darren Croft

unread,
Mar 8, 2017, 10:01:09 AM3/8/17
to Firebase Google Group
We're getting pretty close to the April 20 date now. What can you tell us about the status of a solution.

Thanks,
Darren

reyn...@gmail.com

unread,
Mar 27, 2017, 6:00:25 PM3/27/17
to Firebase Google Group
Hey guys, any update regarding this issue? In version 3.7.1 from March 9th they solved the issue for Chrome extensions but still failing for Cordova/Ionic apps.

Bassam

unread,
May 8, 2017, 3:36:57 PM5/8/17
to Firebase Google Group
I apologize for the delay, Firebase JS version 3.9.0 should support signInWithRedirect for Cordova: https://firebase.google.com/support/release-notes/js#3.9.0
Instructions for settting this up are located here:
Reply all
Reply to author
Forward
0 new messages