Sets the OAuth custom parameters to pass in a Google OAuth request for popup and redirect sign-in operations. Valid parameters include 'hd', 'hl', 'include_granted_scopes', 'login_hint' and 'prompt'. For a detailed list, check the Google documentation. Reserved required OAuth 2.0 parameters such as 'client_id', 'redirect_uri', 'scope', 'response_type' and 'state' are not allowed and will be ignored
Wrapped in a function inside a react hook component
constsignIn=()=>{constprovider=newfirebase.auth.GoogleAuthProvider();provider.setCustomParameters({hd:"wsj.com"});firebase.auth().signInWithPopup(provider).then(function(result){ // This gives you a Google Access Token. You can use it to access the Google API.vartoken=result.credential.accessToken; // The signed-in user info.varuser=result.user;console.log("signed-in",user); // ...}).catch(function(error){ // Handle Errors here.varerrorCode=error.code;varerrorMessage=error.message; // The email of the user's account used.varemail=error.email; // The firebase.auth.AuthCredential type that was used.varcredential=error.credential;console.log("error",error); // ...});};