# Third-party auth providers

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

:::warning
To make these instructions concrete, this guide uses [Firebase](https://firebase.com) as a sample third party auth provider.
:::

The supported authentication providers are:

### Third-party auth platforms

* [**Firebase**](/docs/configuration/external-auth/firebase) - `ThirdPartyOAuthProvider.FIREBASE`
* [**Better-Auth**](/docs/configuration/external-auth/better-auth) - `ThirdPartyOAuthProvider.BETTER_AUTH`
* [**Supabase**](/docs/configuration/external-auth/supabase) - `ThirdPartyOAuthProvider.SUPABASE`
* [**PlayFab**](/docs/configuration/external-auth/playfab) - `ThirdPartyOAuthProvider.PLAYFAB`
* [**AccelByte**](/docs/configuration/external-auth/accelbyte) - `ThirdPartyOAuthProvider.ACCELBYTE`
* [**LootLocker**](/docs/configuration/external-auth/lootlocker) - `ThirdPartyOAuthProvider.LOOTLOCKER`

### Custom Auth Methods

* [**Custom OIDC**](/docs/configuration/custom-auth/oidc-token) - `ThirdPartyOAuthProvider.OIDC`
* [**Custom Auth**](/docs/configuration/custom-auth/auth-token) - `ThirdPartyOAuthProvider.CUSTOM`

To authenticate with a third-party provider, set up the `thirdPartyAuth` configuration when initializing `Openfort`.

```ts [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:

:::code-group
```tsx [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();
  }
});

```

```ts [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;
```
:::
