Sign in via custom OIDC
The reference registrar is an OpenID Connect provider. Any relying party that supports a custom OIDC provider with PKCE can use it to sign people in with a did:guardian identity. The examples use guardianspec.org. Replace it with your registrar's domain.
Background. The OIDC provider is a feature of the reference registrar, not of the did:guardian method. Another conformant registrar may not offer it. See the registrar API for the full surface.
What you need
- A relying party that supports the authorization code flow, PKCE with
S256, and ID tokens signed with ES256 or ML-DSA-44. - The relying party's callback URL.
- A did:guardian identity on the registrar, with its login secret.
1. Check the provider
curl https://guardianspec.org/.well-known/openid-configuration
The issuer is https://guardianspec.org. The response lists "code_challenge_methods_supported": ["S256"] and "scopes_supported": ["openid", "email", "create:managed-identity"].
It also lists "id_token_signing_alg_values_supported": ["ML-DSA-44", "ES256"]. A registrar whose operator disabled ES256 lists only ["ML-DSA-44"].
2. Register an OAuth client
Client registration follows RFC 7591 and needs no account.
curl -X POST https://guardianspec.org/oauth/register-client \
-H "Content-Type: application/json" \
-d '{"redirect_uris": ["https://your-app.example.com/oauth/callback"], "client_name": "My App"}'
{
"client_id": "...",
"client_id_issued_at": 1796043229,
"redirect_uris": ["https://your-app.example.com/oauth/callback"],
"client_name": "My App",
"token_endpoint_auth_method": "client_secret_basic",
"id_token_signed_response_alg": "ES256",
"registration_access_token": "...",
"registration_client_uri": "https://guardianspec.org/oauth/register-client/...",
"client_secret": "..."
}
Save client_secret and registration_access_token. Each is shown once.
For a mobile app or single-page app with no server, add "token_endpoint_auth_method": "none" to the request. The response then has no client_secret, and the client authenticates with PKCE alone.
To read the registration later, send GET to registration_client_uri with Authorization: Bearer <registration_access_token>. The response includes id_token_signed_response_alg.
Choose the ID token algorithm
Each client chooses how its ID tokens are signed, with id_token_signed_response_alg (RFC 7591):
| Value | Algorithm | When to use it |
|---|---|---|
"ES256" |
ECDSA P-256 | The default. Most relying-party libraries support it. It is not post-quantum. |
"ML-DSA-44" |
ML-DSA-44 (FIPS 204, RFC 9964) | Your library can verify ML-DSA-44. It is post-quantum. |
To request ML-DSA-44, add it to the registration request:
curl -X POST https://guardianspec.org/oauth/register-client \
-H "Content-Type: application/json" \
-d '{"redirect_uris": ["https://your-app.example.com/oauth/callback"], "client_name": "My App", "id_token_signed_response_alg": "ML-DSA-44"}'
The response returns "id_token_signed_response_alg": "ML-DSA-44". A value other than "ES256" or "ML-DSA-44" is refused with 400 and "error": "invalid_client_metadata".
An operator can set OIDC_ES256 to "disabled". That registrar then signs every ID token with ML-DSA-44, its default is ML-DSA-44, and it refuses a registration that asks for ES256.
Access tokens are always signed with ML-DSA-44, whatever the client chooses. See Post-quantum security.
3. Configure the relying party
| Setting | Value |
|---|---|
| Issuer or discovery URL | https://guardianspec.org |
| Client ID | client_id |
| Client secret | client_secret, or none for a public client |
| Token endpoint auth | client_secret_basic or client_secret_post |
| Scopes | openid email |
| PKCE | On, S256 |
The redirect_uri the relying party sends must match a registered URI exactly.
4. Sign in
The relying party sends you to the registrar's login form. Enter your identity's name and login secret. The name field accepts alice or alice@guardianspec.org. If the relying party passes login_hint, the field is filled in for you.
To sign in as the registrar's root identity, enter _@guardianspec.org. Bare _ and @guardianspec.org also work where the form allows them.
On first sign-in, approve the consent screen. The registrar remembers an approval for each client and identity. It asks again only when the client requests a scope that wasn't approved before.
Result
The token response contains an id_token, an access_token, and a refresh_token. ID and access tokens expire after 1 hour. Refresh tokens expire after 30 days and rotate on each use.
| Claim | Where | Value |
|---|---|---|
iss |
ID token, access token | https://guardianspec.org |
sub |
ID token, access token, /userinfo |
The identity's DID, for example did:guardian:guardianspec.org:alice |
aud |
ID token, access token | The client_id |
email, email_verified |
ID token, /userinfo |
alice@guardianspec.org. Present only with the email scope and a verified forwarding address. |
name |
/userinfo only |
The identity's name. The root identity returns the registrar domain. |
email is always the identity's address on the registrar's domain. It never reveals where mail is forwarded. The profile scope adds no claims.
Validate tokens
- Verify the signature with the keys at
https://guardianspec.org/.well-known/jwks.json. Select the key by thekidin the token header. The JWKS has an ML-DSA-44 key ("kty": "AKP","alg": "ML-DSA-44", public key inpub) and, unless the operator disabled ES256, an ES256 key ("kty": "EC","crv": "P-256"). - An ID token's
algis the client'sid_token_signed_response_alg. Reject a token whosealgis not the one you registered. - An access token's
algis alwaysML-DSA-44, with an empty context string. To validate access tokens yourself, use a JOSE library that supports ML-DSA-44. Otherwise, send the access token to/userinfoand let the registrar check it. - Check that
issis the issuer andaudis yourclient_id. If you sent aresourceparameter at/authorize,audis that resource instead. - Send only the
access_tokenas a bearer token. Access tokens carry"typ": "access". The registrar's endpoints reject an ID token.
Troubleshooting
code_challenge is required. Turn on PKCE withS256in the relying party.redirect_uri not registered for this client. Register the exact callback URL.- No
emailclaim. Request theemailscope, and set up and verify email forwarding for the identity on the account dashboard. - The relying party expects an email as the subject.
subis always the DID. Map users byemail, or invite the identity by hand in the relying party. - Signed in as the wrong identity. Sign out at
/account, or have the relying party sendlogin_hint. The registrar shows the login form when the hint doesn't match the current session. - The library rejects the ID token's algorithm. Your library cannot verify the registered algorithm. Register a new client with
"id_token_signed_response_alg": "ES256", if the registrar offers it, or use a library that supports ML-DSA-44. invalid_client_metadataat registration.id_token_signed_response_algmust be"ML-DSA-44"or"ES256". A registrar with ES256 disabled accepts only"ML-DSA-44".prompthas no effect. The registrar ignores thepromptparameter.
Next steps
- Let one identity act as another it guards with token exchange.
- Create identities from your app with the Managed Identity API.
- Run your own provider: Self-host a registrar.