Home

Supabase Auth

Learn how to interact with Supabase

Supabase is an open-source alternative to Firebase. It provides a variety of tools and services to help with Postgres database, Authentication, instant APIs, Realtime, Functions, Storage and Vector embeddings.

Prerequisites#

Head to your Project Settings in the Supabase Console and grab your Project URL and anon API Key.

Set up your provider#

To set up Supabase to authenticate players with Openfort, visit your dashboard provider settings.

supabase auth

Client-side Integration#


_16
import type { Provider } from "@supabase/supabase-js";
_16
import Openfort from "@openfort/openfort-js";
_16
_16
const signInWithProvider = async (provider: Provider) => {
_16
const supabase = createServerRouteClient();
_16
const { data, error } = await supabase.auth.verifyOtp({
_16
type,
_16
token_hash,
_16
});
_16
const openfort = new Openfort({
_16
baseConfiguration: {
_16
publishableKey: OPENFORT_PUBLISHABLE_KEY
_16
}
_16
});
_16
const authResponse = await openfort.authenticateWithThirdPartyProvider({provider:ThirdPartyOAuthProvider.SUPABASE, token:data.session?.access_token, tokenType: TokenType.CUSTOM_TOKEN});
_16
};

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": "supabase",
_12
"disabled": false,
_12
"externalUserId": "2"
_12
}
_12
]
_12
}

Resources#