> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getlurk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sign-in with Supabase

> Trust your Supabase project so the people who sign in to your app can read their own balance and receipts, with the access token Supabase already gives them.

Lurk accepts the access token Supabase Auth gives a signed-in person. You give Lurk your project ref. Lurk works out the issuer and the key address from it.

## What you need from Supabase

* **Asymmetric signing keys.** Lurk verifies the token against your project's public keys. A project that still signs with the legacy shared secret (`HS256`) has no keys to fetch, and its tokens are refused as `unsupported_algorithm`. Move the project to asymmetric signing keys in Supabase first.
* **Your project ref.** It is the 20 lower-case letters at the start of your project address, `https://<ref>.supabase.co`.

Lurk derives these from the ref and nothing else:

| What | Value |
| - | - |
| Issuer (`iss`) | `https://<ref>.supabase.co/auth/v1` |
| Keys | `https://<ref>.supabase.co/auth/v1/.well-known/jwks.json` |
| Audience | `authenticated`, unless you list others |
| Algorithms | `RS256` and `ES256`, unless you choose one |

## What Lurk requires of a Supabase token

* `is_anonymous` is present and is the boolean `false`. A person signed in anonymously (`true`) is refused as `anonymous_session`. A token without the claim, or with a value that is not a boolean, is refused as `invalid_token`. A Custom Access Token Hook can remove the claim, so do not remove it.
* `role`, if present, is `authenticated`. The project's `anon` and `service_role` keys are refused.
* It meets the common rules in the [overview](https://docs.getlurk.com/end-user-auth/overview.md#what-the-token-must-carry).

Supabase access tokens last 3,600 seconds by default.

## Add it to Lurk

An owner or admin does this, in person. In the dashboard, open Settings, then the Sign-in tab, and choose **Add a provider**. Or call `POST /v1/trusted-issuers` as a member.

| Field | Value |
| - | - |
| `name` | A name for you, up to 80 characters. |
| `profile.provider` | `supabase` |
| `profile.project_ref` | Your 20-letter ref. |
| `profile.audiences` | Optional. 1 to 20 values. Default `["authenticated"]`. |
| `profile.algorithms` | Optional. `RS256`, `ES256` or both. |
| `profile.max_token_lifetime_seconds` | Optional. See [the overview](https://docs.getlurk.com/end-user-auth/overview.md#what-the-token-must-carry). |

The issuer is saved **paused**, and its address cannot be edited later.

> [!WARNING]
>
> The `supabase` profile takes only a project ref. It cannot take a custom auth domain. Whether a custom domain changes the token's `iss` is not settled. Do not register a Supabase project as `oidc` to get around this: an address ending in `.supabase.co` is refused there.

## Check the keys, then turn it on

1. **Check keys.** In the dashboard, choose **Check keys**. Or `POST /v1/trusted-issuers/{id}/check` with the `expected_revision` you read from the issuer. Lurk fetches the key set and saves how many usable keys it found. A problem is shown on the issuer.
2. **Turn it on.** Choose **Turn on**, or `POST /v1/trusted-issuers/{id}/activate` with `expected_revision`. The last check must be recent: see [Clerk](https://docs.getlurk.com/end-user-auth/clerk.md#check-the-keys-then-turn-it-on).
3. **Allow new people and events.** Save `new_people_per_hour` (1 to 1,000) and the event names a device may send in **Events people’s apps may send**, under Settings > Sign-in. Without a limit on new people, a person who has never signed in is refused. See [Client API](https://docs.getlurk.com/end-user-auth/client-api.md).

## Test it

Sign in to your app as a real user, copy the access token Supabase gave it, and test it. In the dashboard, choose **Test a token** on the issuer and paste it. See [Linking people](https://docs.getlurk.com/end-user-auth/linking-people.md#test-a-token).

A good answer is `verified` with `access` `ready`. Anonymous users answer `anonymous_session`. A token for another project answers `wrong_issuer`. If nothing matches, see [Troubleshooting](https://docs.getlurk.com/end-user-auth/troubleshooting.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.