function signIn() {
const provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('https://www.googleapis.com/auth/userinfo.email');
firebase
.auth()
.signInWithPopup(provider)
.then(result => {
// Returns the signed in user along with the provider's credential
console.log(`${result.user.displayName} logged in.`);
window.alert(`Welcome ${result.user.displayName}!`);
})
.catch(err => {
console.log(`Error during sign in: ${err.message}`);
window.alert('Sign in failed. Retry or check your browser logs.');
});
}
Nächste Schritte
Informationen zum Suchen und Filtern von Codebeispielen für andere Google Cloud-Produkte finden Sie im Google Cloud-Beispielbrowser.