Firebase Auth
Learn how to interact with Firebase
Firebase is a development platform from Google that provides a variety of tools and services to help developers build, improve, and grow their apps, with features such as databases, analytics, messaging, and crash reporting. It emphasizes easy integration and real-time updates, enabling developers to create rich, collaborative experiences.
Prerequisites#
Head to your Project Settings in the Firebase Console and grab your Firebase Project ID.
Set up your provider#
To set up Firebase to authenticate players with Openfort, visit your dashboard provider settings.
Client-side Integration#
_14import {GoogleAuthProvider, getAuth, signInWithPopup} from "firebase/auth";_14import Openfort from "@openfort/openfort-js";_14_14 function loginWithGoogle() {_14 const googleProvider = new GoogleAuthProvider();_14_14 signInWithPopup(auth, googleProvider)_14 .then(async (result) => {_14 const idToken = await result.user.getIdToken();_14 const openfort = new Openfort(process.env.NEXT_PUBLIC_OPENFORT_PUBLIC_KEY!);_14_14 const token = await openfort.authenticateWithThirdPartyProvider("firebase", idToken, TokenType.IdToken);_14 })_14 }
Uppon successful authentication, the SDK will return: