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.
![firebase auth](https://blog-cms.openfort.xyz/uploads/firebase_auth_8ccee72abf.png?updated_at=2023-11-09T19:56:44.398Z)
Client-side Integration#
_18import {GoogleAuthProvider, getAuth, signInWithPopup} from "firebase/auth";_18import Openfort from "@openfort/openfort-js";_18_18 function loginWithGoogle() {_18 const googleProvider = new GoogleAuthProvider();_18_18 signInWithPopup(auth, googleProvider)_18 .then(async (result) => {_18 const idToken = await result.user.getIdToken();_18 const openfort = new Openfort({_18 baseConfiguration: {_18 publishableKey: OPENFORT_PUBLISHABLE_KEY_18 }_18 });_18_18 const token = await openfort.authenticateWithThirdPartyProvider({provider:ThirdPartyOAuthProvider.FIREBASE, token:idToken, tokenType:TokenType.ID_TOKEN});_18 })_18 }
Uppon successful authentication, the SDK will return: