OpenID ConnectAuthorization code + PKCE

Sign in with NobleID

Let researchers sign in to your journal, repository, conference system or app with their NobleID. With their permission, your app also gets their profile, ORCID iD, affiliations and registered works.

What you get

A standard OpenID Connect provider. Any OIDC library works; each piece of data is a separate scope the person can see and untick on the consent screen.

  • Sign-in

    A stable account identifier (sub) and the person’s NobleID, with no password for you to store.

  • Profile

    Name, username, photo, website and research interests.

  • Verification flags

    Whether the person passed NobleID’s identity check, and whether NobleID staff have marked them a verified researcher.

  • ORCID iD

    The iD on their NobleID profile, flagged verified only when it was connected through ORCID’s own sign-in.

  • Affiliations

    Organization, role and start year as entered by the person.

  • Works

    The works they registered on NobleID, each with its ARK, DOI where there is one, and version.

Everything is read-only. No scope lets an app change a NobleID account or register works on someone’s behalf. (Partner minting, works:write, is planned for a partner program and is not available.)

Get started

  1. Register an app in Dashboard → OAuth apps. Choose confidential if you have a server, public for a browser-only or native app. Add your exact redirect URI (http is allowed on localhost while you test). You need two-step login on your NobleID to register or edit an app.
  2. Add the button. It links to your server, which sends the person to the authorize endpoint with PKCE, state and nonce. A browser-only app can let the SDK do this.
  3. Handle the callback. Check state and iss, exchange the code, verify the ID token and key the account on sub.
Step by step, with code

Codes and access tokens are short-lived. Ask for offline_access only if you need to call NobleID when the person is not present, and store the new refresh token each time you use one. The consent screen pre-ticks only what is already public on the person's profile.

Code

Copy-paste starting points. Each one uses PKCE, state and nonce and checks the issuer. Do not remove those parts. They ask for openid profile, the scopes a new app has; tick more on your app before you ask for them.

App Router, confidential client, two route handlers, jose for ID-token verification. Link your sign-in button to /auth/nobleid/start.

.env.local
# .env.local  (server-only: no NEXT_PUBLIC_ prefix)
NOBLEID_CLIENT_ID=nbcl_your_client_id
NOBLEID_CLIENT_SECRET=nbcs_your_client_secret
# While you test. In production, register and use your https URL.
NOBLEID_REDIRECT_URI=http://localhost:3000/auth/nobleid/callback

# npm install jose
app/auth/nobleid/start/route.ts
// app/auth/nobleid/start/route.ts
import { NextResponse } from "next/server"
import crypto from "node:crypto"

const b64url = (buf: Buffer) => buf.toString("base64url")

export async function GET() {
  const state = b64url(crypto.randomBytes(32))
  const nonce = b64url(crypto.randomBytes(32))
  const verifier = b64url(crypto.randomBytes(32))
  const challenge = b64url(crypto.createHash("sha256").update(verifier).digest())

  const url = new URL("https://www.nobleid.org/oauth/authorize")
  url.search = new URLSearchParams({
    response_type: "code",
    client_id: process.env.NOBLEID_CLIENT_ID!,
    redirect_uri: process.env.NOBLEID_REDIRECT_URI!,
    scope: "openid profile",
    state,
    nonce,
    code_challenge: challenge,
    code_challenge_method: "S256",
  }).toString()

  const res = NextResponse.redirect(url)
  // Short-lived, httpOnly, scoped to the callback path. SameSite=Lax is sent
  // on the top-level redirect back from NobleID.
  res.cookies.set("nobleid_oidc", JSON.stringify({ state, nonce, verifier }), {
    httpOnly: true,
    secure: process.env.NODE_ENV === "production", // http://localhost while you test
    sameSite: "lax",
    path: "/auth/nobleid",
    maxAge: 600,
  })
  return res
}
app/auth/nobleid/callback/route.ts
// app/auth/nobleid/callback/route.ts
import { NextRequest, NextResponse } from "next/server"
import { createRemoteJWKSet, jwtVerify } from "jose"

const ISSUER = "https://id.nobleid.org"
const JWKS = createRemoteJWKSet(new URL(`${ISSUER}/.well-known/jwks.json`))

function fail(msg: string) {
  const res = new NextResponse(`Sign-in failed: ${msg}`, { status: 400 })
  res.cookies.delete({ name: "nobleid_oidc", path: "/auth/nobleid" })
  return res
}

export async function GET(req: NextRequest) {
  const raw = req.cookies.get("nobleid_oidc")?.value
  if (!raw) return fail("session expired, try again")
  const { state, nonce, verifier } = JSON.parse(raw)

  // Check state, then iss, before believing anything else in the URL,
  // an error included: a forged callback can carry any error it likes.
  const q = req.nextUrl.searchParams
  if (q.get("state") !== state) return fail("state mismatch")
  if (q.get("iss") !== ISSUER) return fail("issuer mismatch") // RFC 9207
  if (q.get("error")) return fail(q.get("error_description") ?? q.get("error")!)

  // Token exchange: form-encoded, client_secret_basic.
  const id = encodeURIComponent(process.env.NOBLEID_CLIENT_ID!)
  const secret = encodeURIComponent(process.env.NOBLEID_CLIENT_SECRET!)
  const tokenRes = await fetch(`${ISSUER}/oauth/token`, {
    method: "POST",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
      Authorization: `Basic ${Buffer.from(`${id}:${secret}`).toString("base64")}`,
    },
    body: new URLSearchParams({
      grant_type: "authorization_code",
      code: q.get("code") ?? "",
      redirect_uri: process.env.NOBLEID_REDIRECT_URI!,
      code_verifier: verifier,
    }),
    cache: "no-store",
  })
  if (!tokenRes.ok) return fail("token exchange failed")
  const tokens = await tokenRes.json()

  // Verify the ID token: ES256 signature against NobleID's JWKS, iss, aud, exp.
  const { payload } = await jwtVerify(tokens.id_token, JWKS, {
    issuer: ISSUER,
    audience: process.env.NOBLEID_CLIENT_ID!,
    algorithms: ["ES256"],
  })
  if (payload.nonce !== nonce) return fail("nonce mismatch")

  // Optional: claims that are only in userinfo (affiliations, research_interests…)
  const userinfo = await fetch(`${ISSUER}/oauth/userinfo`, {
    headers: { Authorization: `Bearer ${tokens.access_token}` },
    cache: "no-store",
  }).then((r) => r.json())
  if (userinfo.sub !== payload.sub) return fail("userinfo subject mismatch")

  // Key the account on payload.sub (stable). Never link accounts by email
  // unless email_verified is true.
  // const user = await upsertUser({ nobleidSub: payload.sub, nobleid: payload.nobleid, name: userinfo.name })
  // await createYourOwnSession(user)

  const res = NextResponse.redirect(new URL("/", req.url))
  res.cookies.delete({ name: "nobleid_oidc", path: "/auth/nobleid" })
  return res
}

Platform guides

Step-by-step settings for research platforms that already support OpenID Connect.

Library settings

PKCE with S256 is required for browser and mobile apps and recommended for server apps. ID tokens are signed with ES256. Many libraries expect RS256 and do not check the iss response parameter, so they need a setting changed or a check added.

LibraryChange
openid-client v6 (Node)Client metadata id_token_signed_response_alg: 'ES256'. Call enableNonRepudiationChecks(config) to verify ID token signatures. PKCE with calculatePKCECodeChallenge. Checks iss itself.
openid-client v5 / NextAuth v4id_token_signed_response_alg: 'ES256' (the default is RS256). NextAuth v4: idToken: true, checks: ['pkce', 'state', 'nonce'].
Auth.js v5client: { id_token_signed_response_alg: 'ES256', token_endpoint_auth_method: 'client_secret_basic' }, checks: ['pkce', 'state', 'nonce']. It checks iss but does not verify the ID token signature and does not call userinfo: do both yourself. Its own session sub is not NobleID's sub.
Python Authlibclient_kwargs={'code_challenge_method': 'S256'}, or it sends no PKCE. Use client_secret_post. Check iss yourself.
Go: go-oidc v3 + x/oauth2SupportedSigningAlgs: []string{oidc.ES256}. Set Endpoint.AuthStyle explicitly. Check iss and nonce yourself.
Rust: openidconnect 4set_allowed_algs(vec![CoreJwsSigningAlgorithm::EcdsaP256Sha256]) on the ID token verifier. Use a custom AdditionalClaims type, or NobleID claims are dropped. Check iss yourself.
PHP league/oauth2-client'pkceMethod' => 'S256' and 'scopeSeparator' => ' '. Verify the ID token with firebase/php-jwt (ES256) and check iss, aud and nonce yourself.
PHP jumbojett/openid-connect-phpCannot verify ES256 ID tokens (1.0.2). Not usable with NobleID.
Spring SecurityOidcIdTokenDecoderFactory.setJwsAlgorithmResolver(r -> SignatureAlgorithm.ES256). PKCE for confidential clients with OAuth2AuthorizationRequestCustomizers.withPkce(). Add a filter that checks iss.
ASP.NET Core OpenIdConnectResponseMode = Query (the default is form_post), UsePkce = true, TokenValidationParameters.ValidAlgorithms = ["ES256"], MapInboundClaims = false. Check iss yourself.
Ruby omniauth_openid_connect 0.8client_signing_alg: :ES256, pkce: true, send_nonce: true, client_auth_method: :basic, send_scope_to_token_endpoint: false. Check iss and the userinfo sub yourself.
Keycloak, WordPress and other platformsSee the platform guides below.

Scopes & claims

openid is required. Ask only for what you use. People see every scope and can untick the optional ones, so read the granted scope in the token response rather than assuming.

ScopeClaims
openidrequired

Your NobleID and a stable account identifier

  • sub: Stable, opaque account identifier (a UUID). Use this as the key for the person in your database. It is not the NobleID number.
  • nobleid: The person’s public NobleID code.
  • nobleid_uri: https://www.nobleid.org/{nobleid}, the link to show next to their name.
profile

Your name, username, photo, website, research interests and verification badges

  • name
  • given_name
  • family_name
  • preferred_username
  • profile: The person’s public NobleID profile page. Absent when their profile is not public.
  • picture: An https URL.
  • website: An http or https URL.
  • research_interests: Userinfo only.
  • identity_verified: true when the person has passed NobleID’s identity check. One overall result, not per-step.
  • nobleid_verified_researcher: true when NobleID staff have granted the verified-researcher badge.
  • profile_complete: true when every item on the person’s NobleID profile checklist is done: name, affiliation, country, research fields, bio and proof of research. Sign-in needs only a real name, so this can be false. A refresh reports the current state.
  • verification_level: "profile" (complete), "orcid" (complete, ORCID iD proven through ORCID) or "authorship" (complete, at least one work whose authorship NobleID confirmed). "incomplete" until the checklist is done. Not an identity check.
  • updated_at
email

Your email address

  • email
  • email_verified: true only when the person has confirmed this address: they opened the single-use link NobleID emailed to it, or Google or Apple vouched for the same address at sign-in. Changing the address resets it. Do not link accounts by an unverified email.
orcid

Your ORCID iD, only if you connected it through ORCID's own sign-in

  • orcid: Full https://orcid.org/… URI. Released only when the person connected it through ORCID’s own sign-in; a typed-in iD is never released.
  • orcid_verified: Always true when orcid is present (kept for clients that read it).
affiliations

Your main institution with its ROR iD, and each institution, role and start year on your profile

  • affiliation: { name, ror? }: the person’s main affiliation as they entered it; ror is the organization’s ROR iD when they chose one. Not checked by NobleID.
  • affiliations: Userinfo only. [{ organization, role?, start_year?, ror? }], the main affiliation first. start_year is a number; ror is an https://ror.org/ URL. As entered by the person. Not checked by NobleID.
works

The list of works you have registered, with their ARK identifiers, and how many works NobleID has confirmed you as an author of

  • works_count: Userinfo. Number of works the person has registered (verified or not).
  • verified_authorship_count: Userinfo. Number of works NobleID’s authorship check has confirmed this person as an author of. Pending, rejected and disputed claims do not count.
  • works_endpoint: Userinfo. GET it with the access token: https://id.nobleid.org/oauth/works?limit=50&offset=0 (limit 1 to 100).
roles

Your reviewer/editor roles, availability and expertise (subjects, languages, work types, typical turnaround). Never your contribution or other private settings.

  • roles: The reviewer, editor and copy-editor roles on the person’s public profile: "reviewer", "editor", "copy_editor". An empty list when they show none.
  • availability: Keyed by role: { status, until? }. status is "available", "limited" or "not_available".
  • expertise: { subjects, languages, work_types, turnaround_days? }, as the person entered them. Not checked by NobleID.
offline_access

Stay connected when you are not using the app

No claims. Returns a refresh token.

Works items (GET https://id.nobleid.org/oauth/works, Bearer token with scope works): nobleid, ark, url, title, type, doi, publication_date, publication_year, version, registered_at.

A claim with no value is left out, never sent as null. To fill your own app's profile from these claims, see Fill your app's profile from NobleID.

Endpoints

Issuerhttps://id.nobleid.org
Discoveryhttps://id.nobleid.org/.well-known/openid-configuration
Authorizationhttps://www.nobleid.org/oauth/authorize
Tokenhttps://id.nobleid.org/oauth/token
Userinfohttps://id.nobleid.org/oauth/userinfo
JWKShttps://id.nobleid.org/.well-known/jwks.json
Revocationhttps://id.nobleid.org/oauth/revoke
End session (sign-out)https://www.nobleid.org/oauth/logout
Introspectionhttps://id.nobleid.org/oauth/introspect
Pushed authorization (PAR)https://id.nobleid.org/oauth/par
Works list (scope works)https://id.nobleid.org/oauth/works?limit=50&offset=0
  • The authorization endpoint is the consent page on www.nobleid.org; every other endpoint is under the issuer, id.nobleid.org. Fetch the discovery document rather than hard-coding URLs.
  • Only response_type=code. PKCE must be S256: browser and mobile apps must use it; server apps should. No implicit or hybrid flow, no plain PKCE.
  • The token endpoint accepts application/x-www-form-urlencoded only. ID tokens are ES256 JWTs.
  • The authorization response includes iss (RFC 9207). Check it equals the issuer.

Security requirements for your integration

  • Use PKCE with S256, with a fresh random verifier of at least 32 bytes. Browser and mobile apps must; server apps should.
  • Send a random state and check it on return; send a nonce and check it in the ID token.
  • Check iss in the authorization response, and iss, aud (your client ID) and exp in the ID token.
  • Verify the ID token’s ES256 signature against the JWKS on your server. Cache the key set and refetch when you see an unknown kid.
  • Register exact redirect URIs. They are compared character for character; https only, except http on localhost / 127.0.0.1 / [::1], where the port may vary. A public native app may also use a reverse-DNS scheme such as org.example.app:/callback.
  • Keep the client secret on your server. Browser and mobile apps must be public clients.
  • Key accounts on sub, never on email. Never link an existing account by email unless email_verified is true.
  • Refresh tokens are single-use: store the new one each time.
  • On sign-out, revoke the refresh token at https://id.nobleid.org/oauth/revoke.
  • To end the NobleID session too, send the person to https://www.nobleid.org/oauth/logout with id_token_hint, post_logout_redirect_uri and state (OpenID Connect RP-Initiated Logout 1.0, GET or form POST). NobleID asks a signed-in person to confirm, then returns them to that URL with your state. Add the URL to the app's sign-out return URLs in the dashboard first. It must match exactly.

Security

  • Tokens are short-lived and signed. Verify ID tokens against the published keys (JWKS).
  • People can disconnect an app at any time in Settings → Connected apps.
  • Partner apps can only be registered and managed from accounts with two-step login.

What a NobleID sign-in tells you: the person controls a NobleID account that signs in with email and password, Google or Apple, and, if they have turned it on, also entered a code from an authenticator app (two-step login). Two-step login is optional, so read amr (below) to see how this sign-in was done. identity_verified tells you separately whether the account holder passed an identity check.

How the person signed in (amr)

ID tokens from the authorization-code exchange carry amr (RFC 8176): the methods the person used to sign in to NobleID for this session, alongside auth_time.

ValueMeaning
pwdEmail and password.
googleSign in with Google (Google verified the account; NobleID did not see a password).
appleSign in with Apple.
privyLegacy sign-in (Privy), kept for older accounts.
otpA code from the person’s authenticator app (RFC 6238 TOTP), or one of their single-use backup codes.
mfaTwo methods were used: one of the above plus otp.

Examples: ["pwd"], ["pwd","otp","mfa"], ["google"], ["google","otp","mfa"].

  • To require two-step login, check that amr contains otp and send the person back if it does not; they can turn it on in their NobleID security settings.
  • If amr is absent, treat the sign-in as password or provider only.
  • acr is not used. max_age and prompt=login are supported. prompt=login does not ask again if the person signed in within the last 2 minutes. To force a fresh sign-in, send max_age=0 and check auth_time.
  • Two-step login is a time-based code from an authenticator app, with single-use backup codes. NobleID does not offer passkeys, WebAuthn security keys or SMS codes.

Branding

  • Use the official button: pick a label, theme, shape and size on the button page, or let the SDK draw it. Don’t redraw, recolor or stretch the logo.
  • Wording: “Sign in with NobleID” or “Continue with NobleID”.
  • Pick a theme that stands out from the page: black or green on white, white or green on dark. Use an outline button only where its text reads clearly against your background.
  • Minimum height 40px. Keep clear space around the button of at least half its height (20px at 40px).
  • Keep a visible focus outline on the link or button.
  • Place it with equal prominence next to your other sign-in options.
  • Show a person’s NobleID as the full link, e.g. https://www.nobleid.org/{nobleid} (the nobleid_uri claim).
Download all (ZIP, SVG and PNG)

FAQ

What is the difference between sub and nobleid?
sub is an opaque, stable account identifier. Use it as your database key. nobleid is the person’s public NobleID code, for display and linking.
Can my app register works or edit a profile?
No. All scopes are read-only. Partner minting (works:write) is planned for a partner program and is not available today.
Is there single sign-out?
Your app can end the person’s NobleID session: send them to https://www.nobleid.org/oauth/logout. NobleID asks a signed-in person to confirm, then returns them to a registered sign-out return URL with your state. There is no front-channel or back-channel logout, so other apps the person signed in to stay signed in. Also sign the person out of your own app and revoke their refresh token.
How does my app get the verified badge on the consent screen?
Email info@nobleid.org with your client ID to request verification. Until then people see a “not verified” notice.

Test client

Run a real sign-in against NobleID with your own client ID, and see exactly what your app would receive.

  1. In OAuth apps, register a public client (or edit one) and add this redirect URI exactly:
https://www.nobleid.org/developers/sign-in/callback
  1. Paste its client ID below, pick scopes, and run the flow. You will see the real consent screen.
  2. On return, this page exchanges the code (a public client sends no secret), checks the ID token’s signature against NobleID’s published keys, and shows its claims and the userinfo response.

Confidential clients cannot be tested here: their code exchange needs the client secret, which must never be typed into a web page. Use your own server, or register a second, public client for testing.

    ByNobleID