Management API Reference

Authentication

Third-party auth providers

Learn how to integrate with third-party auth provider.

Openfort's embedded signers are fully-compatible with any authentication provider that supports JWT-based, stateless authentication. If you're looking to add embedded signers to your app, you can either:

You will need to call the authenticateWithThirdPartyProvider method:


_10
import {ThirdPartyOAuthProvider, TokenType} from "@openfort/openfort-js";
_10
_10
await openfort.authenticateWithThirdPartyProvider({
_10
provider: ThirdPartyOAuthProvider.FIREBASE, // or SUPABASE, etc.
_10
token: "YOUR_USER_AUTH_TOKEN",
_10
tokenType: TokenType.ID_TOKEN, // or CUSTOM_TOKEN
_10
});

To make these instructions concrete, this guide uses Firebase as a sample third party auth provider that you can integrate alongside Openfort.

Follow the guide on how to configure third party auth to learn more. The supported loginMethods are 'accelbyte', 'custom', 'firebase', 'supabase', 'lootlocker', 'playfab' and 'oidc'.

auth.tsx
openfortConfig.ts

_13
import {GoogleAuthProvider, getAuth, signInWithPopup} from "firebase/auth";
_13
import {ThirdPartyOAuthProvider, TokenType} from "@openfort/openfort-js";
_13
import openfort from "./openfortConfig"
_13
_13
async function loginWithGoogle() {
_13
const googleProvider = new GoogleAuthProvider();
_13
_13
signInWithPopup(auth, googleProvider)
_13
.then(async (result) => {
_13
const idToken = await result.user.getIdToken();
_13
const token = await openfort.authenticateWithThirdPartyProvider({provider:ThirdPartyOAuthProvider.FIREBASE, token:idToken, tokenType:TokenType.ID_TOKEN});
_13
})
_13
}

Uppon successful authentication, the SDK will return:

response.json

_12
{
_12
"id": "pla_cc9ed2b7-c5f5-4c43-8dca-c4b104ba1762",
_12
"object": "player",
_12
"createdAt": 1710976453,
_12
"linkedAccounts": [
_12
{
_12
"provider": "firebase",
_12
"disabled": false,
_12
"externalUserId": "2"
_12
}
_12
]
_12
}

Example#