Sign in with NobleID on Keycloak
Add NobleID as an identity provider in Keycloak, so every application behind it can offer Sign in with NobleID.
- Written for
- Keycloak 26.x (labels checked in 26.8).
- Tested
- Written from the platform's documentation and source code. Not yet run against NobleID.
Register on NobleID
- In Dashboard β OAuth apps, register a confidential app. You need two-step login on your NobleID to do this.
- Add this redirect URI, with your own host:Keycloak shows this URL, read-only, when you add the provider. The alias is part of it, so set the alias first. Tick ORCID iD too if you will map it.
https://sso.example.org/realms/<realm>/broker/nobleid/endpoint - Tick these scopes: OpenID (always on), Profile
profile, Emailemail. The platform asks for these, and sign-in stops if it asks for a scope the app does not have. - Copy the client ID and the client secret. The secret is shown once.
The app works at once. Until NobleID verifies it, people see a βnot verifiedβ notice on the consent screen.
1. Add the provider
Keycloak runs the sign-in: people choose NobleID on the Keycloak login page, and your applications keep talking to Keycloak. This is also the working route for platforms whose own OIDC client cannot handle NobleID, such as OJS.
Identity providers β Add provider β OpenID Connect v1.0:
| Field | Value |
|---|---|
| Alias | nobleid |
| Display name | NobleID |
| Use discovery endpoint | On |
| Discovery endpoint | https://id.nobleid.org/.well-known/openid-configuration |
Fill in the client details:
| Field | Value |
|---|---|
| Client authentication | Client secret sent as HTTP Basic authentication (the request-body option also works) |
| Client ID | nbcl_your_client_id |
| Client Secret | nbcs_your_client_secret (or a vault reference) |
Discovery fills in the rest. Click Add, then check these values on the provider's settings page:
| Field | Value |
|---|---|
| Authorization URL | https://www.nobleid.org/oauth/authorize (the www host is correct) |
| Token URL | https://id.nobleid.org/oauth/token |
| Logout URL | https://www.nobleid.org/oauth/logout (filled by discovery; see step 4) |
| User Info URL | https://id.nobleid.org/oauth/userinfo |
| Issuer | https://id.nobleid.org |
| Validate Signatures | On |
| Use JWKS URL | On |
| JWKS URL | https://id.nobleid.org/.well-known/jwks.json |
Turn on PKCE yourself. Discovery does not set it. On the provider's settings page, set Use PKCE On and PKCE Method S256, then Save. Keycloak's default method is plain, which NobleID refuses.
Keycloak checks NobleID's ES256 ID tokens with the JWKS URL. No algorithm setting is needed.
2. Advanced settings
| Field | Value |
|---|---|
| Pass login_hint, Pass max_age, Pass current locale | Off |
| Backchannel logout | Off |
| Disable user info | Off (some claims are only in userinfo) |
| Disable nonce | Off |
| Scopes | openid profile email (add orcid if you map the ORCID iD) |
| Prompt | Unspecified |
| Trust Email | On. Keycloak then copies NobleID's email_verified onto the user instead of trusting every address. |
| Account linking only | Off |
| First login flow override | empty (the realm's first broker login flow) |
| Sync mode | Import, or Force to update the Keycloak user on every sign-in |
Also turn on Realm settings β Login β Verify email. Trust Email only copies email_verified. Without Verify email, a NobleID user with an unconfirmed address gets straight in with that address on their Keycloak account.
3. Mappers
Identity providers β nobleid β Mappers β Add mapper. Keycloak's default username is NobleID's preferred_username, which can change and can collide with a local username. Use sub instead:
| Field | Value |
|---|---|
| Mapper type | Username Template Importer |
| Template | ${ALIAS}.${CLAIM.sub} |
| Target | LOCAL |
| Sync mode override | Import |
To keep NobleID claims, add an Attribute Importer for each, with Sync mode override Force:
| Claim | User attribute | Needs scope |
|---|---|---|
nobleid | nobleid | openid |
orcid | orcid | orcid (present only if the person connected ORCID by signing in with it) |
identity_verified | identity_verified | profile |
Declare these attributes under Realm settings β User profile β Create attribute, viewable by administrators and editable by nobody. Otherwise Keycloak ignores them. To pass them on to your applications, add a User Attribute mapper to a client scope.
4. First sign-in and existing accounts
The default first broker login flow is the safe one. It creates a new user when nobody has the same email or username. If someone does, it asks the person to prove they own that account, by email or by signing in to it, before linking.
Do not build a flow with Automatically Set Existing User. It links whatever account has the matching email, without proof.
To admit only people whose identity check passed, set Verify essential claim On, Essential claim identity_verified, Essential claim value true. The check reads the ID token, which carries identity_verified when the app asks for profile.
With Logout URL set, signing out of Keycloak also ends the NobleID session. Keycloak sends the person to NobleID, which asks them to confirm, and NobleID sends them back to https://sso.example.org/realms/<realm>/broker/nobleid/endpoint/logout_response with Keycloak's state. Add that URL to the app's sign-out return URLs in the NobleID dashboard. To end only the Keycloak session, empty Logout URL; the person then stays signed in at nobleid.org. Keep Backchannel logout off: it makes Keycloak call the Logout URL from its server, and NobleID's sign-out needs the person's browser.
Fill the profile from NobleID
| NobleID claim | Keycloak user | Scope |
|---|---|---|
given_name | First name (built in) | profile |
family_name | Last name (built in) | profile |
email | Email (built in) | email |
picture | attribute picture | profile |
website | attribute website | profile |
orcid | attribute orcid | orcid |
affiliation.name | attribute affiliation | affiliations |
Add an Attribute Importer per attribute and declare each attribute, as in step 3. Keycloak reads a nested claim with a dot: affiliation.name.
With Sync mode override Force, Keycloak overwrites the attribute at every sign-in. Use Import (first sign-in only) for anything people edit in Keycloak.
Add orcid and affiliations to the provider's Scopes field, and tick ORCID iD and Affiliations on your app.
Every claim, and how to fill a profile without overwriting what people edit: Fill your app's profile from NobleID.
Before you go live
- Sign in once with your own NobleID. People need a first and last name on their NobleID profile to sign in; NobleID asks for it if it is missing.
- Key accounts on
sub. Link to an existing account by email only whenemail_verifiedis true. - Remove any localhost redirect URIs from the app.
- Keep the client secret out of version control.
NobleID values
| Issuer | https://id.nobleid.org |
| Discovery URL | https://id.nobleid.org/.well-known/openid-configuration |
| Authorization endpoint | https://www.nobleid.org/oauth/authorize |
| Token endpoint | https://id.nobleid.org/oauth/token |
| Userinfo endpoint | https://id.nobleid.org/oauth/userinfo |
| JWKS URL | https://id.nobleid.org/.well-known/jwks.json |
| Revocation endpoint | https://id.nobleid.org/oauth/revoke |
| End-session endpoint | https://www.nobleid.org/oauth/logout |
| ID token signing | ES256 |
Sources
Something here does not match what you see? Email info@nobleid.org.