Sigil

Developer guide

Sign in with Sigil

Use Authorization Code with PKCE S256. The user signs in at Sigil, then returns to your registered callback.

1. Discover the issuer

Use a maintained OpenID Connect library and pin the expected issuer. The discovery document advertises the endpoint URLs and public keys.

Issuer: https://www.sigilid.space
Discovery: https://www.sigilid.space/.well-known/openid-configuration

2. Start authorization

Generate a cryptographic state, nonce, and PKCE verifier for every attempt. Bind them to the browser session and expire them after a short interval. Send the SHA-256 challenge, never the verifier, to the authorization endpoint.

GET /auth
response_type=code
client_id=<approved client ID>
redirect_uri=<exact registered callback>
scope=openid
state=<random state>
nonce=<random nonce>
code_challenge=<base64url SHA-256 of verifier>
code_challenge_method=S256

3. Exchange the code

On return, check state and consume the saved attempt once. POST the code, original verifier, and exact callback to the token endpoint as form data. Use HTTP Basic for a confidential client. Public clients send client_id without a secret.

POST /token
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=…&redirect_uri=…&code_verifier=…

4. Verify the identity

Verify the ID token signature with Sigil’s JWKS. Require RS256, the expected issuer, your client ID as audience, expiry, issue time, and the original nonce. Handle authorized party when multiple audiences are present. Match UserInfo sub to the verified token if you call UserInfo.

Store (iss, sub) as the account key. Use usernames, emails, and handles for display. Account linking requires proof of both accounts.

Run the example

Save the download as sigil-sign-in.mjs. Use Node 22 or later. Set your approved client ID and exact callback, and provide the secret as an environment variable for a confidential client. Expose the local process through your registered HTTPS callback origin. Open that origin and choose Sign in with Sigil.

npm install openid-client@6
node --env-file=.env sigil-sign-in.mjs

Set SIGIL_CLIENT_ID, SIGIL_CALLBACK, and, for server apps, SIGIL_CLIENT_SECRET. SIGIL_SCOPE defaults to openid. This single-process example checks sign-in. Use a shared session store and create your app’s session after verification in a deployed app.

Refresh and sign out

To request refresh tokens, register offline_access and request it with consent. Store the newest refresh token atomically and serialize refresh per session. When reuse or expiry invalidates the grant, start a new sign-in. End your app session on sign-out, and use Sigil’s logout endpoint if the user wants to sign out of the issuer.

Endpoint and scope reference · OpenID Connect Core · OAuth security guidance