Authentication
Sign in with your project
Other applications can offer "Sign in with" your project. A person is sent to your project, signs in to your application as usual, agrees on a page of yours, and the other application gets a code it swaps for tokens. This is OAuth 2.1 (authorization code with PKCE) with OpenID Connect for the identity.
The other application gets an identity: the account's ID, and its email address and name if it asked and the person agreed. It never reaches your project's tables.
Switching it on
Sign-in, Applications that sign in here. Only an owner of the company changes anything here; other members can look.
- Write the page of your application where people agree, and enter its address as the consent address. It must be one of the project's site addresses.
- Switch on Let registered applications send people here to sign in.
- Add application for each one: the name people see, its return addresses (matched exactly, character for character;
https, or plainhttponly on127.0.0.1orlocalhostfor a native app), and whether it runs on a server and can keep a secret. A secret is shown once; New secret replaces it.
The flow
1. The other application sends the person here:
GET https://api.rezincore.com/v1/oauth/authorize?project=<project ID>&client_id=<client ID> &redirect_uri=<a registered address>&response_type=code&scope=openid%20email &state=<its own value>&code_challenge=<S256 challenge>&code_challenge_method=S256&nonce=<optional>
PKCE with S256 is required for every application, with a secret or without. A wrong client_id or redirect_uri is answered there and never sent anywhere; any other fault goes back to the return address with error.
2. Your consent page is opened with ?rezin_oauth_request=<id>. Sign the person in the way your application does, then, with your publishable key and the person's token:
GET /v1/oauth/requests/<id> → { "client": { "name": "Partner app", "clientId": "rzo_…" }, "scopes": ["openid", "email"], "agreedBefore": false, "redirectHost": "partner.example.com" }
POST /v1/oauth/requests/<id>/decision { "allow": true } → { "redirect": "https://partner.example.com/callback?code=…&state=…" }
Send the person's browser to redirect. A refusal sends them back with error=access_denied. A request lasts ten minutes and is answered once. Only the person's own sign-in can answer it: an application can never answer for them.
3. The other application swaps the code (once, within 60 seconds, with the same return address and the PKCE verifier):
POST /v1/oauth/token grant_type=authorization_code&code=…&redirect_uri=…&code_verifier=… (client ID and secret as HTTP Basic, or client_id and client_secret in the form; client_id alone without a secret)
→ { "access_token": "rzat_…", "token_type": "Bearer", "expires_in": 3600, "scope": "openid email", "id_token": "…", "refresh_token": "rzrt_…" }
id_token comes with openid, refresh_token with offline_access. A code used a second time is refused, and everything made from its first use stops working.
4. Afterwards: GET /v1/oauth/userinfo with the access token answers the claims the scopes allow. POST /v1/oauth/token with grant_type=refresh_token gives new tokens and a new refresh token; each refresh token works once, and using an old one again ends the whole sign-in. POST /v1/oauth/revoke with token=… ends a token (a refresh token ends the whole sign-in).
Scopes and claims
| Scope | Gives |
|---|---|
openid | sub: the account's ID. Needed for an ID token and for userinfo |
email | email, and email_verified (always false for now) |
profile | name |
offline_access | a refresh token (lives 30 days, used once each) |
Checking ID tokens
ID tokens are JWTs signed with ES256 by a key of the project's own, and live ten minutes. The issuer is https://api.rezincore.com/v1/oauth/p/<project ID>; its metadata is at that address plus /.well-known/openid-configuration, and the public keys at /v1/oauth/jwks?project=<project ID>. Check iss, aud (your client ID), exp and, if you sent one, nonce.
Make a new key on the console page replaces the key at once. The old one stays published for 15 minutes, longer than any ID token it signed lives, and then goes.
Ending sign-ins
- The person:
GET /v1/auth/grantslists the applications they let in;DELETE /v1/auth/grants/<id>ends one. - An owner: End beside it on the console page, or Remove the application.
- Disabling the account, changing its password, or Sign out everywhere on the account's page ends all of its.
- Switching the feature off stops every token at once.
Access tokens are looked up on every use, so each of these takes effect immediately.
What is kept
Client secrets, codes, and access and refresh tokens only as hashes. Signing keys sealed with the master key; only their public halves are ever published. Consent, token issue and a reused code or refresh token are on the project's record.
Not yet
Reaching the project's tables on a person's behalf; scopes beyond identity; keys rotated on a timetable (rotation is by hand); email_verified from a confirmed address; calls to the token endpoint from a browser page of another site (allowed by the API, but untested with real clients).