Authentication
Every request to a Lovelace service carries an identity: either a user who signed in, or a service acting on its own behalf. Which one you use decides who the platform bills, whose data a request can touch, and what it is allowed to do. The two credential types are OAuth access tokens and developer API keys, and both are governed by scopes.
Two credential types#
User-authorized — OAuth 2.1 with PKCE ("Sign in with Lovelace"). Your app
sends the user to accounts.uselovelace.com, they approve a consent screen, and
your app receives an access token that represents that user. Requests made with
it run as the user, on the user's compute and account. This is the credential to
use when an end user should authorize — and pay for — what your app does on their
behalf (for example, routing an assistant's model calls to the user's own
personal runtime). See
Sign in with Lovelace to add it to an app.
Developer-paid — API keys. A key you create in the developer portal (API keys) authenticates your service to the platform, with your developer account footing the bill. Use it for server-to-server calls where there is no end user to authorize. Never ship a developer key in browser or mobile code; have the browser call your backend, and let the backend hold the key.
Scopes decide what a credential can do#
A token or key is only allowed to do what its scopes permit. Scopes are the
same regardless of credential type — for example openid/profile/email for
identity, or lattice:compute:inference to send compute requests. When your app
requests a Lattice compute scope, the user sees it on the consent screen and must
approve it before your app can use it; approval is what grants the authority. Ask
only for the scopes you need.
Consent is per-user and revocable#
For user-authorized apps, the grant is between the user and your app: the user
approves the scopes once, can see the connected app later, and can revoke it at
any time. When a grant is revoked or is missing a scope, the API returns a typed
error (for example revoked_grant or insufficient_scopes) and your app should
re-run the sign-in flow rather than guess.
Choosing#
| You are… | Use | Who pays / owns the data |
|---|---|---|
| A third-party app acting for a signed-in user | Sign in with Lovelace (OAuth) | the user |
| A backend service with no end user | Developer API key | your developer account |
Related#
- Sign in with Lovelace — add OAuth sign-in to an app
- API keys — create and manage developer keys
- Lattice Cloud — the compute these credentials authorize