Sign in with Doorman

Let agents sign in to your service with their Doorman address: a standard OpenID Connect provider whose subject is an agent's inbox, with what a service configures, proves and reads.

On this page
  1. What a service accepts
  2. What to configure
  3. Register a relying party
  4. Prove the host is yours
  5. Or publish your identity
  6. The sign-in a service runs
  7. Scopes and claims
  8. Lifetimes and keys
  9. When the owner stops a sign-in
  10. When a request is refused
  11. What to show

What a service accepts

Sign in with Doorman makes an agent's address an identity your service can ask for. Doorman is the OpenID Connect provider, your service is the relying party, and the subject is the agent's inbox. The agent signs in as itself: no form, no password and no email code, and every sign-in says that the one signing in is an agent.

Nothing here is proprietary. A service adds this provider the way it adds any other: an issuer, a client id, and a secret or PKCE. Any OpenID Connect client library can speak it, and so can a sign-in service that takes a custom OpenID Connect provider.

The owner decides
The person who owns the agent allows your service once for each address. After that the agent signs in, and back in, alone. The owner can stop it at any time.
A host, not a name
Your service is identified by a host it proved is its own. People are shown that host; the name you register is a label beside it.
Not an API credential
Nothing a sign-in issues reaches the Inbox API, and no API key is accepted where a sign-in token is expected.

What to configure

These are the values an OpenID Connect client asks for. Discovery fills in the endpoints from the issuer.

Issuer
https://id.doorman.example. Discovery is https://id.doorman.example/.well-known/openid-configuration, and the signing keys are https://id.doorman.example/sign-in/jwks.json. The issuer is a host of its own and does not change once you integrate.
Client id
The identifier the console gives your relying party when you register it, or the URL of an identity document you publish.
Secret, or PKCE
A registered relying party gets a secret, shown once, unless you register a public one. A public one holds no secret and sends an S256 PKCE challenge with every request. A confidential one may send a challenge too.
Redirect URI
Each one registered exactly, on your host. The provider compares it exactly, except the port of a redirect on your own machine.
Scopes
A request that names none asks for openid and email. See scopes and claims.
Signing algorithm
ES256, and no other. An id token's kid is its key's RFC 7638 thumbprint.
Response type
code. Authorization code flow only.
Token endpoint authenticationHow the relying party presents itself
client_secret_basicThe secret in an Authorization: Basic header. The default for a registered relying party.
client_secret_postThe secret as client_secret in the form body.
noneA public relying party: no secret, and S256 PKCE on every sign-in.

A relying party with a secret presents it the way it registered and is refused the other way.

Register a relying party

OAuth clients in the console, one of the developer tools, lists your relying parties under Sign in with Doorman. Registering one takes a console session: no API key and no app token can.

Name
What your service calls itself, at most 100 characters. A label, not proof of who you are.
Host
The host agents sign in at, such as app.example.net. A public DNS name of your own. A name on a shared platform is refused, because the names under it belong to different people. The host never changes: register another relying party for another host.
Redirect URIs
At most 10, each on the host: HTTPS on the default port.
Start URL
Optional. Where your service starts a sign-in, on the host. See the sign-in.
Client type
Confidential with the secret in HTTP Basic, confidential with the secret in the body, or public.

An account registers at most 25 relying parties. The secret is shown once, on registration and again on rotation, and a rotated secret replaces the one before it at once. Editing a relying party ends the sign-ins in progress and keeps the addresses already allowed. Deleting one removes what owners decided about it.

The same operations are in the reference: register, update, rotate the secret, verify the host and delete.

Prove the host is yours

Until its host is verified, a relying party signs in only addresses of the account that registered it, and to every other account it does not exist. That is enough to build and test with. To sign in anyone's agent, serve one file from the host.

  1. Open the relying party in the console and choose Verify host. It shows the file's address, https://<host>/.well-known/doorman-sign-in.json, and its JSON.
  2. Serve that JSON at that address, over HTTPS, without a redirect.
  3. Choose Verify host. The provider reads the file and marks the host verified.

https://app.example.net/.well-known/doorman-sign-in.json

{
  "client_id": "sic_...",
  "proof": "the value the console shows"
}

The read is one GET that follows no redirect and carries no credential, within 5 seconds and 8 KiB. Fields beside client_id and proof are ignored. Anything else answers 409 host_proof_failed with what was found, and changes nothing.

Or publish your identity

A service may skip registration and name itself by a document it publishes: the Client ID Metadata Document that apps use, read the same way. Its URL is the client_id.

  • The host is the document's own, so it is verified by construction.
  • The relying party is always public: it holds no secret and uses S256 PKCE.
  • Only the redirects on the document's own host are kept.
  • initiate_login_uri, where the document states one, is the start URL.

The sign-in a service runs

A sign-in begins with the agent, not at your sign-in page. Your side of it is the ordinary authorization code flow.

  1. The agent asks for a sign-in to your service (inboxes.signIns.create) and is handed a single-use link, good for 5 minutes, which it opens in the browser that should hold the session.
  2. A Doorman page says which address signs in to which host and waits for a click. The click sends the browser to your start URL with iss and login_hint: OpenID Connect's third-party initiated login. Without a start URL the browser is sent to your front page.
  3. Your start URL checks that iss is this issuer and begins a login: a fresh state, a nonce, an S256 challenge, and a redirect to the authorization endpoint. Pass login_hint along.
  4. The provider checks the request and, for the browser that opened the link, answers at once. The browser returns to your redirect with code, your state and iss. Where nothing ties the browser to an address, the owner is asked instead, and the request waits up to 15 minutes.
  5. Check state and iss, then exchange the code at the token endpoint within 60 seconds. Verify the id token: its signature against the published keys, and its iss, aud, exp and nonce.
  6. Create or find the account by sub, and start your own session. Read userinfo when you want the claims as they are now.

TypeScript: begin a login and exchange the code

const ISSUER = "https://id.doorman.example";
const discovery = await (await fetch(`${ISSUER}/.well-known/openid-configuration`)).json();

// At the start URL: iss has to be this issuer, and login_hint is the address that signs in.
const url = new URL(discovery.authorization_endpoint);
url.search = new URLSearchParams({
  response_type: "code",
  client_id: process.env.DOORMAN_CLIENT_ID,
  redirect_uri: "https://app.example.net/auth/callback",
  scope: "openid email profile",
  state, nonce, // random, kept in this browser's session
  code_challenge: challenge, code_challenge_method: "S256",
  login_hint: loginHint,
}).toString();
// Redirect the browser to url.

// At the redirect URI: check state and iss first, then exchange the code once.
const response = await fetch(discovery.token_endpoint, {
  method: "POST",
  headers: {
    "content-type": "application/x-www-form-urlencoded",
    authorization: `Basic ${btoa(`${process.env.DOORMAN_CLIENT_ID}:${process.env.DOORMAN_CLIENT_SECRET}`)}`,
  },
  body: new URLSearchParams({
    grant_type: "authorization_code", code,
    redirect_uri: "https://app.example.net/auth/callback", code_verifier: verifier,
  }),
});
const tokens = await response.json();
// Verify tokens.id_token (ES256, the keys at discovery.jwks_uri) before trusting a claim.

The operations are in the reference: discovery, the keys, authorize, token and userinfo. A request with prompt=none is honored: where the owner would have to decide, the answer is login_required.

Scopes and claims

ScopeWhat it tells your service
openidThe agent's subject: a stable identifier for the address, and that it is an agent. Every sign-in carries it.
emailThe address the agent signs in as, which the service can write to.
profileThe address's display name, and an identifier for its owner that is different at every service.
owner_profileThe name of the person or organization that owns the agent. Released only where the owner allowed it for that service.
owner_emailThe owner's own email address. Released only where the owner allowed it for that service.

A request that names scopes must name openid. Scopes this provider does not have are ignored, as OpenID Connect asks, so offline_access and a sign-in service's own scopes do not fail a request. owner_profile and owner_email say who owns the agent: ask for them by name, and you are told only where the owner allowed it for your service. Where they are asked for and not allowed, the sign-in still succeeds without them, and the token answer's scope says what was granted.

ClaimScopeMeaning
subopenidThe address's subject. The same at every service, and a new one if the address is ever given up and issued again. Key your account on this, not on the address.
actor_typeopenidAlways agent: the one signing in is software acting for its owner.
emailemailThe address the agent signs in as.
email_verifiedemailAlways true: the provider is where the address lives.
nameprofileThe address's display name, when it has one.
owner_subprofileWho owns the agent, as an identifier that is different at every service and the same for every agent of that owner at yours.
owner_nameowner_profileThe owner's name, only where the owner allowed it for your service.
owner_emailowner_emailThe owner's own email address, only where the owner allowed it for your service.
owner_email_verifiedowner_emailAlways true where owner_email is present.

The claims of an id token

{
  "iss": "https://id.doorman.example",
  "aud": "sic_01jc5f1a2b3c4d5e6f7g8h9j0k",
  "iat": 1793959500,
  "exp": 1793960100,
  "auth_time": 1793959490,
  "jti": "ddddddddddddddddddddddddddddddddddddddddddd",
  "nonce": "n-0S6_WzA2Mj",
  "sub": "f0Jx2kQp9wLr7TzV3mYb8nHc5dGs1aKe4uWq6oPi0Ag",
  "actor_type": "agent",
  "email": "concierge@doorman.example",
  "email_verified": true
}

Userinfo answers a SignInUserInfo: every claim derived again from live state on each call, so a renamed address, a withdrawn permission or a stopped address shows at once.

Lifetimes and keys

  • A code is single use and lasts 60 seconds. A code presented twice ends the tokens its first exchange returned.
  • The id token and the access token last 10 minutes. The access token reads userinfo and nothing else.
  • There is no refresh token. A longer session is your own: keep it as you keep any session, and start a new sign-in when you need the provider's word again.
  • Discovery and the keys may be kept for 300 seconds. A new key is published before it signs, so read the keys again when a token names a kid you do not have.

When the owner stops a sign-in

The owner sees every service an address signs in to in their Passport, with the first and last sign-in and their count, and can stop one at any time. Stopping ends what the provider can end: the links, codes and tokens of that address at your service. The token exchange refuses a code issued before the stop, and userinfo answers 401 for a token issued before it.

The session your service keeps is your own, and the provider cannot end it. Read userinfo while a session is young, or ask for a fresh sign-in before anything that matters, and treat 401 or access_denied as the owner's no.

When a request is refused

A request whose relying party or redirect cannot be trusted is answered where it is and never redirected. Every later refusal goes back to your redirect with error, your state and iss. The token and userinfo endpoints answer { "error": "<code>" }, sometimes with an error_description: a fixed sentence written by the provider, never text taken from the request. A program branches on error.

ErrorWhen
invalid_requestA parameter the endpoint reads is missing, malformed, repeated or too long, or a public relying party sent no S256 challenge.
invalid_clientThe relying party is unknown, deleted or lapsed, or its authentication failed or came the way it did not register.
invalid_grantThe code is unknown, expired, used, or not this relying party's for this redirect and verifier. Also a code issued before the owner stopped the address.
invalid_scopeThe request names scopes and leaves out openid.
unauthorized_clientNamed in the protocol and kept in this provider's vocabulary. It does not answer it today; treat it as a refusal if it ever appears.
unsupported_grant_typeThe grant is not authorization_code.
unsupported_response_typeThe response type is not code.
access_deniedThe owner denied the sign-in, or stopped this address signing in to your service.
login_requiredThe request asked for prompt=none and the owner would have to decide.
interaction_requiredNamed in the protocol and kept in this provider's vocabulary. It does not answer it today; treat it as a refusal if it ever appears.
request_not_supportedThe request carries a request object. Send plain parameters.
request_uri_not_supportedThe request carries a request_uri. Send plain parameters.
registration_not_supportedThe request carries a registration parameter. Register in the console or publish an identity document.
invalid_tokenAt userinfo: the access token is missing, unknown, expired or ended.
invalid_client_metadataA published identity document could not be read or did not check out.
temporarily_unavailableA rate limit was reached, or too many requests are waiting. Retry-After says when to try again.
server_errorNamed in the protocol and kept in this provider's vocabulary. It does not answer it today; treat it as a refusal if it ever appears.

What to show

Show the words Sign in with Doorman as plain text, in your own interface's type. There is no logo button and no badge to place beside them: the words are the whole of it. Do not suggest that Doorman verified, endorsed or operates your service.

Up Down to move, Enter to open, Esc to close