Accounts, applications and grants
The onefold model — one account per person, applications that request access, and the grant that connects them — and what stays in your own application.
onefold has three objects you work with: the account a person holds, the application you register, and the grant that connects the two. This page defines each and draws the line between what onefold keeps and what your application keeps.
Account
An account is one person on onefold. A person has one account, whichever application they first came through, and signs in to every application built on onefold with it.
Your application identifies an account by sub:
- It never changes for the life of the account.
- It is the same in the ID token, in userinfo, in webhook payloads and in the management API.
- It is a string. Every ID onefold returns is a 64-bit number sent as a string, because
the value is too large for a JavaScript
number. Parsing one changes it without raising an error. Store IDs as strings and compare them as strings.
Key each user on sub in your own database. An email address and a username can both change.
Application
An application is your registration with onefold. It holds:
- a client ID, and a client secret unless it is a public client
- the redirect URIs onefold may send users back to
- the scopes it may request
- everything users see on the way in: sign-in methods, the hosted sign-in page, the consent screen
An application is confidential or public. A confidential application runs on a server and authenticates with its client secret. A public application runs where a secret cannot be kept, such as a browser or a phone, and authenticates with its client ID alone. Both use PKCE.
An application belongs to the person who registered it or to an organization. Deleting an application ends every grant and revokes every token issued to it.
Grant
A grant is one person's approval of one application for a set of scopes. It comes into being when the person authorizes your application, and it is what your tokens are issued under.
Your application gets a grant, not a user. You do not receive a copy of the account, and you cannot read anything about a person who has not authorized your application. The grant decides what you can read, through its scopes.
A grant ends when:
- the person removes your application from their authorized applications,
- you revoke it from the application's Users tab,
- the person resets their password through account recovery, or their account is disabled,
- your application is deleted.
When a grant ends, its tokens stop working at once. See Sign out and revoke.
What onefold keeps and what you keep
| onefold | Your application |
|---|---|
| Credentials: passwords, passkeys, second factors | Your own session, and how long it lasts |
| Sign-in, sign-up, email verification and recovery | Your database, with users keyed on sub |
| The person's identity and profile | Roles and permissions inside your product |
| Consent, and the record of who authorized what | Your own data about each user |
onefold is not a database for your application. The one place it stores data on your behalf is user metadata: a small JSON document per user of your application, for values you want next to the identity.
One pool of accounts
onefold is a single pool of people. It is not multi-tenant:
- An application does not have its own separate set of users.
- An organization groups the developers who manage applications. It does not group or separate end users.
- onefold has no roles or permissions for your end users. Authorization inside your product is yours.
What the person controls
A person can, at any time and without involving you:
- see every application they have authorized and remove any of them,
- change their username and profile,
- add or remove passkeys and second factors,
- ask the operator of the platform to change their email address or to disable their account.
Subscribe to webhooks to be told when a person your application knows changes, leaves or is disabled.