Skip to main content
Your app’s users read their own balance and receipts, and send their own events, from the browser or phone, with the sign-in token your app already has from Clerk, Supabase or an OpenID Connect (OIDC) provider. No project key goes in the app.

Before you start

  • Your role. You are an owner or admin of the project. Only they can set this up.
  • The API address. https://api.getlurk.com, for projects made at app.getlurk.com, both Staging and Production. The project ID picks the project.
  • Your project ID, prj_…. It is not a secret. The Project ID under Settings > Project is the project’s short name (organization/project), not prj_…. Choose the project in the dashboard’s project switcher, and the address bar shows ?project=prj_….
Set these once

1. Add your provider

In the dashboard, open Settings, the Sign-in tab, and choose Add a provider. Give it a Name, choose the provider and fill in:
  • Project ref: the 20 letters in https://<ref>.supabase.co.
The project must sign with asymmetric keys, not the legacy shared secret. Supabase
Leave Longest token at 3,600 seconds unless your tokens last longer (Auth0’s: 36,000). It is saved paused.

2. Turn it on

On the provider’s row:
  1. Check keys.
  2. Test a token. Sign in to your app and paste the token your provider gave it. A good token answers The token is good, then This provider is paused, as it should before step 3. OpenID Connect needs this to turn on. Clerk tokens last 60 seconds: paste a fresh one.
  3. Turn on. It shows after a key check in the last 24 hours (and, for OpenID Connect, a verified token test).
  4. Allow new people. In Events people’s apps may send, tick Limit new people, set New people an hour, and choose Save.
Until step 4 is saved, a person who has never signed in is refused: the call answers 401 invalid_key, and the token test says Sign-in with a provider isn’t switched on yet.

3. Make your first call

Send the person’s token as the bearer and your project ID in Lurk-Project.
Read the signed-in person's balances
Success is a 200. A new person’s list is usually empty, and that is correct:
A new person holds a unit only if it starts above 0 (starts_at) or a rule gives it.

4. Send an event

  1. Allow the name. In Events people’s apps may send, add it with Allow an event, such as checkin.scanned, and choose Save. A name not on the list is refused. Saving is refused while a live or paused rule hears the name with no source condition.
  2. Send it with a unique idempotency_key in the body. It is required.
Send an event for the signed-in person
The Idempotency-Key header is optional here. If you send it, Lurk uses its key instead of the body’s. Retrying. After a network failure, a 429 or a 503, resend with the same key: nothing is counted twice. Idempotency and retries The answer lists the receipts the event made. A device’s event is untrusted: only a rule with source: any hears it (Rules).

If it fails

Run Test a token first: the API never says why it refused a token. Every code: Troubleshooting.

What a device may do

A signed-in person’s app is a device. It does the calls above for its own person and nothing else: Lurk reads the person from the token, and a device cannot name another person, change rules, units or settings, or give or take units.

What you trust, and what a device cannot choose

You trust the provider you add. A device cannot choose it.
  • See Add a trusted issuer for setup, approval and address rules.
  • Lurk fetches the signing keys itself, from that address. A key or certificate inside a token is never used.
  • A device sends only the token. A bearer that starts with lurk_, or one next to a member’s session cookie, is refused.
  • Lurk checks the token on every request but does not ask the provider whether the session is alive, so a token works until it expires. Block a person to stop them sooner. See Linking people.
Lurk verifies that your provider’s tenant signed the token, not who owns the tenant. Two Lurk projects that trust the same tenant accept each other’s tokens. Use one provider project for each boundary you want to keep.

What the token must carry

  • A signature from a key in the issuer’s key set, with RS256 or ES256, and a kid in the header.
  • An iss equal to the issuer you saved, exactly.
  • One audience in aud, one you listed. Clerk is the exception: see Clerk.
  • An exp and an iat, with exp minus iat no longer than the issuer’s longest token (60 to 86,400 seconds, 3,600 by default). Lurk allows 30 seconds of clock difference.
  • A sub of 1 to 255 printable ASCII characters, with no spaces.
  • Whatever the provider’s own rules add. Anonymous sessions are refused.
Lurk keeps only the issuer and the sub. It never reads a name, an email or a picture from the token.

Reference

Clerk, Supabase, other providers, Client API (headers, CORS, limits), Linking people (merges, blocks, the token test) and Troubleshooting.