Third-party auth providers
Openfort's embedded wallets are fully-compatible with any authentication provider that supports JWT-based, stateless authentication.
The supported authentication providers are:
Third-party auth platforms
- Firebase -
ThirdPartyOAuthProvider.FIREBASE - Supabase -
ThirdPartyOAuthProvider.SUPABASE - PlayFab -
ThirdPartyOAuthProvider.PLAYFAB - AccelByte -
ThirdPartyOAuthProvider.ACCELBYTE - LootLocker -
ThirdPartyOAuthProvider.LOOTLOCKER
Custom Auth Methods
- Custom OIDC -
ThirdPartyOAuthProvider.OIDC - Custom Auth -
ThirdPartyOAuthProvider.CUSTOM
To authenticate with a third-party provider, set up the thirdPartyAuth configuration when initializing Openfort.
openfortConfig.ts
import { Openfort, ThirdPartyOAuthProvider } from '@openfort/openfort-js';
const openfort = new Openfort({
baseConfiguration: {
publishableKey: "YOUR_OPENFORT_PUBLISHABLE_KEY",
},
thirdPartyAuth: {
provider: ThirdPartyOAuthProvider.FIREBASE,
getAccessToken: async () => {
return (await auth.currentUser?.getIdToken(/* forceRefresh */ false)) ?? null
},
}
});
export default openfort;Then, use the getAccessToken method after logging in, and logout when signing out.
This method exchanges a token from your authentication provider for an Openfort session.
For example, using Firebase:
auth.tsx
import openfort from "./openfortConfig";
import { auth } from "./firebaseConfig";
auth.onAuthStateChanged(async (user) => {
if (user) {
// User is signed in
await openfort.getAccessToken();
} else {
// User is signed out
await openfort.auth.logout();
}
});