How to configure Firebase + Google OAuth with a specific parameter "hd" (hosted domain)?

I am using Firebase with a Google authentication provider.

When using Google OAuth in other applications, I can configure authentication for specific domains.

The Google OpenID Connect documentation has the "hd" parameter used for this feature. https://developers.google.com/identity/protocols/OpenIDConnect#hd-param

How can this be configured for Firebase?

+5
source share
1 answer

With the new setCustomParameters function you can add hd parameter

 var provider = new firebase.auth.GoogleAuthProvider(); provider.addScope('email'); provider.setCustomParameters({ 'hd': 'uw.edu' }); firebase.auth().signInWithRedirect(provider); 

Here is the API documentation https://firebase.google.com/docs/reference/js/firebase.auth.GoogleAuthProvider#setCustomParameters

At least Firebase version 3.5.0 is required - October 14, 2016 https://firebase.google.com/support/release-notes/js

0
source

Source: https://habr.com/ru/post/1240217/


All Articles