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#


_12
import type { Provider } from "@supabase/supabase-js";
_12
import Openfort from "@openfort/openfort-js";
_12
_12
const signInWithProvider = async (provider: Provider) => {
_12
const supabase = createServerRouteClient();
_12
const { data, error } = await supabase.auth.verifyOtp({
_12
type,
_12
token_hash,
_12
});
_12
const openfort = new Openfort(process.env.NEXT_PUBLIC_OPENFORT_PUBLIC_KEY!);
_12
const authResponse = await openfort.authenticateWithThirdPartyProvider("supabase", data.session?.access_token, TokenType.CustomToken);
_12
};

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#