Change or configure OAuth redirect URI

3,787 views
Skip to first unread message

Joel Fernandes

unread,
Oct 13, 2017, 11:11:02 AM10/13/17
to Firebase Google Group
Hi,

I'm currently using Federated identity provider integration, Facebook/Google login, to authenticate my users to the app. In order to make this work, I have to provide a OAuth redirect URI to the provide. The default redirect URI is set to "https://my-app-12345.firebaseapp.com/__/auth/handler"

Is there a way to configure this by adding my own domain? Is there a way to change the redirect URI? 

Any reference article to set up this would be helpful. 

Thank you

Bassam

unread,
Oct 13, 2017, 4:57:18 PM10/13/17
to Firebase Google Group
Hey Joel,
To customize the OAuth domain for the Google/Facebook sign in, you have to use custom domains with Firebase Hosting (since the handler page is hosted there).
For every project we provision a web page to facilitate the OAuth handshake. This would be hosted by Firebase and has the form: https://example.firebaseapp.com/__/auth/handler
This domain/webpage would also need to be whitelisted with the OAuth provider. For Google, it is done automatically.

If you want to use a custom domain, auth.example.com, you would need to point that domain to example.firebaseapp.com.
You would then need to whitelist https://auth.example.com/__/auth/handler at the OAuth provider. In Google's case, you would do it in the cloud console.
Finally, you need to replace their authDomain in the web initialization to their custom domain:
firebase.initializeApp({
  apiKey: ...,
  // authDomain: 'example.firebaseapp.com',
  authDomain: 'auth.example.com',
  ....
});
The next time a user signs in with Google via Firebase, it would appear to be going through https://auth.example.com/__/auth/handler instead of https://example.firebaseapp.com/__/auth/handler from the user's perspective.

Best regards,
Bassam

Joel Fernandes

unread,
Oct 15, 2017, 10:34:49 AM10/15/17
to Firebase Google Group
Thanks Bassam. That works.
Reply all
Reply to author
Forward
0 new messages