Management API Reference

Third-party auth providers

Learn how to integrate with third-party auth provider.

Openfort's embedded wallets are fully-compatible with any authentication provider that supports JWT-based, stateless authentication.

To make these instructions concrete, this guide uses Firebase as a sample third party auth provider.

First, follow the guide on how to configure third party authentication.

The supported authentication providers are ACCELBYTE, CUSTOM, FIREBASE, SUPABASE', LOOTLOCKER, PLAYFAB and 'OIDC'.

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,
_10
token: "YOUR_USER_AUTH_TOKEN",
_10
tokenType: TokenType.ID_TOKEN, // or CUSTOM_TOKEN
_10
});

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
}

Upon successful authentication, the SDK will return a Player object that contains the linked accounts. For example, if you used Firebase as the third-party provider, the response will look like this:

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
}