My place in the WordPress community
- I have had a wordpress.org account since 2006.
- I contributed to WordPress core for versions 7.0 and 7.1.
- I maintain 30 plugins on wordpress.org.
- I organise and speak at WordCamps.
- I have attended every WordCamp Europe from 2017 to 2026.
A health or care service that adds NHS login does not build its own identity checks. It sends the user to NHS login, gets an ID token back and builds a session. My name is Mariusz Szatkowski, and I work from Gdynia, remotely and in writing. My part is the Next.js side of that flow. Which approvals your service needs is NHS England’s decision, and I describe it here from their published pages.

Manchester Town Hall from Lloyd Street, by Mark Andrew, licensed CC BY 2.0, via Wikimedia Commons.
What is NHS login?
NHS England describes NHS login as a way for people to prove who they are online so they can safely reach health and care websites and apps. A partner service that integrates it can offer self-service access and choose the level of verification and authentication its users need. The protocol is OpenID Connect, and the External Interface Specification describes how NHS login applies it.
One restriction is stated plainly: you cannot use NHS login as a one-off linkage key retrieval tool for GP credentials.
Who can use NHS login?
The developer pages I read do not answer this. They cover how to integrate, not who qualifies. The NHS England product page on digital.nhs.uk refused automated reads, so I could not check it and I do not build a claim on it. The onboarding team lists england.engage.nhslogin@nhs.net as the contact on the developer site. Ask them whether your service qualifies before anyone writes code for production.
What is open to everyone is the sandpit, described below.
How does onboarding work?
NHS England publishes three environments and what each one is for.
| Environment | Purpose | Requirements |
|---|---|---|
| Sandpit | Build a proof of concept and learn the journey, designed to reflect the External Interface Specification | None |
| Integration | Technical conformance testing to go live, regression testing against NHS login releases, and the conformance report needed for the Supplier Conformance Assessment List | Sandpit integration complete, an ODS code, and a Data Security and Protection Toolkit covering the scope of the service |
| Live production | The live service | Approval by the Partner Integration Board, readiness activity completed and an agreement signed |
NHS England says to build the proof of concept in the sandpit before you apply. Neither the sandpit nor the integration environment is meant for non-functional or penetration testing, none of the three allows load testing, and no real ID should be used in the test environments. A test user can be provided in live for smoke testing.
The NHS login integration process page points to an integration toolkit, an integration plan you can download and a document library. The process diagram on that page is an image, so I cannot list its steps here.
What does the technical conformance test check?
NHS England describes the integration-environment tests by supplier type.
- IM1 suppliers create records in their local GP system from the patient details NHS login provides, share linkage key, account ID and ODS code with NHS login, register new NHS login accounts with email and password, complete the GP Online or identity verification journey, and confirm that login redirects to the service with the matching patient record.
- Other suppliers use the basic patient records in the integration environment, create accounts, complete the GP Online journey with valid test details, and confirm that verified accounts are redirected to the service.
- FIDO UAF, for example Touch ID, is optional and added by contacting NHS login.
Whether your app falls under IM1 is part of the conversation with onboarding, not something I decide.
Which identity level should the app request?
NHS login supports three identity proofing levels, based on the standard NHS England calls DAPB3051.
- P0, low: ownership of an email address and mobile phone number is verified.
- P5, medium: user details are checked against a PDS record.
- P9, high: photo ID is physically compared with the person asserting their identity.
The request carries a vtr parameter, the Vectors of Trust. Components inside one vector must all be met, and separate vectors are alternatives. The authentication components are Cp (email and password), Cd (a registered device through a text message OTP or a remembered browser) and Cm (a cryptographic key on a registered device, such as a FIDO device). Ck is listed but not yet implemented. If you omit vtr, NHS login uses the default set P9.Cp.Cd, P9.Cp.Ck and P9.Cm. Any value you request must be configured for your service, otherwise the request is rejected.
NHS England advises requesting the lowest identity level the service can accept. A service with both basic and sensitive features can ask for P5 and, when the user opens a sensitive feature, start a step-up journey to P9. The identity_proofing_level claim tells the app the highest level the user has reached, so the app knows when a step-up is needed.
Which scopes and claims does the app get?
The openid scope is mandatory for all partners. NHS England’s table shows how the others depend on the level:
- profile returns NHS number, surname, date of birth and identity proofing level, from P5 up.
- basic_demographics returns surname, date of birth and identity proofing level. It is mutually exclusive with profile, so both cannot be requested together.
- email and phone are available at every level. gp_registration_details gives the ODS code from P5 up.
- gp_integration_credentials (linkage key, ODS code, account ID) is available at P9 only and only to IM1 enabled partners, directly or through an approved supplier.
- Gender or sex, postcode and address are not available as claims.
The NHS number is part of a claimed identity. NHS England says the user must not be given or shown the NHS number that NHS login traced, and that NHS login must understand your use case for it. Request only the scopes your feature needs.
What does the login flow look like in Next.js?
NHS login uses the authorisation code flow. Your service sends the user to the authorize endpoint with client_id, redirect_uri, scope, vtr, a state value and a nonce. NHS England requires a new, unpredictable nonce in every authorisation request, stored until the ID token is checked, and the service must not sign the user in if the nonce claim is missing or does not match. NHS login returns an authorisation code, and your server exchanges it at the token endpoint, which requires private_key_jwt authentication. The ID token must be validated before use.
A Next.js Route Handler can start the flow. Cookies can be set in Route Handlers, not while a Server Component renders, according to the Next.js documentation. The sketch below keeps state and nonce in a short-lived cookie. SameSite lax is my choice, because the return from NHS login is a top-level navigation.
// app/auth/nhs/start/route.ts (sketch, not production code)
import { randomBytes } from 'node:crypto'
import { cookies } from 'next/headers'
import { redirect } from 'next/navigation'
export async function GET() {
const state = randomBytes(32).toString('base64url')
const nonce = randomBytes(32).toString('base64url')
const jar = await cookies()
jar.set('nhs_tx', JSON.stringify({ state, nonce }), {
httpOnly: true,
secure: true,
sameSite: 'lax',
maxAge: 600,
path: '/auth/nhs',
})
const url = new URL(process.env.NHS_AUTHORIZE_URL!)
url.search = new URLSearchParams({
response_type: 'code',
client_id: process.env.NHS_CLIENT_ID!,
redirect_uri: process.env.NHS_REDIRECT_URI!,
scope: 'openid profile',
vtr: process.env.NHS_VTR!, // format as in the External Interface Specification
state,
nonce,
}).toString()
redirect(url.toString())
}The callback handler compares the returned state with the cookie, exchanges the code, validates the ID token including the nonce, and only then creates the app session. The signed client assertion for the token endpoint is built on the server from the private key, which stays in server-only environment variables.
How do I create the key pair?
NHS England’s guidance generates an RSA key pair with OpenSSL, 2048 bits, and says to send only the contents of the public key file when you request access to a new environment. The private key signs the client assertion at the token endpoint. Use a separate key pair per environment, because the sandpit and live must not share secrets.
What if the user does not consent?
NHS login asks users to agree to share their information at first sign-in, when they register a new level of verification and when your service updates the information it needs. If they agree, your service gets an authorisation code. If they do not, NHS login redirects back without a code and issues no ID token. The callback route must handle a return without a code as a normal outcome, not as an error page from the framework.
If your service is opened in the NHS App or Wayfinder, NHS England requires specific error content and back-button behaviour: say “the service provider” rather than your service name, add no other content, and do not add your own back button. Read that page before you design the error state.
How do I manage the session?
NHS login does not support user session management or logout. Your service owns the session once the user is signed in, and NHS England points to NIST SP 800-63B and 800-63C. Additional authentication used alongside NHS login must meet Authentication Assurance Level 2.
For a standalone web application, the user must complete a full authentication journey after 30 minutes of inactivity and after 12 hours of continuous use, and the app must redirect them to it automatically at the end of each period. In Next.js that means a session cookie with a server-side expiry check, not just a client timer. Rules for mobile apps with user-to-app authentication differ and are on the same NHS England page.
Checklist for a Next.js app with NHS login
- Ask the NHS login onboarding team whether the service qualifies.
- Build the proof of concept in the sandpit with the test login.
- Decide the lowest identity level that works, and plan a P5 to P9 step-up if needed.
- Request only the scopes the feature uses, and never display the traced NHS number.
- Generate state and nonce per request, and check both on return.
- Keep the private key on the server and register the public key per environment.
- Handle the no-consent return and the NHS App error screens.
- Build the 30 minute and 12 hour session rules into the session cookie.
- Prepare the ODS code and the Data Security and Protection Toolkit for the integration environment.
How does a project run?
- You send what the app does, the identity level you expect, the scopes you think you need and where it is in onboarding.
- I write down the scope and my assumptions, including the questions only NHS England can answer.
- I build the Next.js side against the sandpit, and you test with the prepared test login.
- After written acceptance, the same code moves to the integration environment for NHS England’s conformance testing. The tests, the reports and the go-live decision stay with you and NHS England.
I need access to the repository and hosting, and the registration details NHS England issues to you. The broader Next.js work I take on is described on the Next.js developer page.
Planning NHS login for a Manchester service
If your team in Manchester is weighing NHS login for a Next.js app, use the contact form to send a short description of the user journey, the identity level you expect and where onboarding stands. The first written estimate for the Next.js work is free. Whether your service qualifies stays with NHS England, and I will say where my part ends.
Selected projects
Examples of my work.
Corporate Website: BALTIC PALACE
Baltic Palace is a unique spot on the map of the Polish coastline, combining modernity with cozy interior designs and a distinctive architectural form. Locat...
Corporate Website: centrum-csr.com
centrum-csr.com is a modern online platform dedicated to promoting the concept of Corporate Social Responsibility (CSR) and sustainable development. The webs...
Corporate Website: DIGITAL WORLD CAPITAL LLP
Digital World Capital LLP is an alternative investment manager specializing in the telecommunications and media sectors on a global scale. The company focuse...
Need this service: Next.js developer in Manchester?
Describe your project by e-mail. I reply within 24 hours.
Describe your projectExplore other WordPress services and knowledge base
Migration to Astro, Next.js, and headless WordPress.
WooCommerce sync with ERP and wholesale systems.
Business process automation around WordPress and company systems.
Library of concrete automation use cases.
Headless WordPress, Sanity, Strapi, and Contentful with Astro or Next.js.
Astro, MDX, edge delivery, and Core Web Vitals measured on real traffic.
Custom WordPress engineering and architecture.
Scalable headless, ERP, and AI architecture for enterprise.
Related categories
Supporting articles

Six to sixteen weeks for typical engagements, with a four-phase shape: discovery, scoping, build and cutover, tuning. The variables are catalogue size, integration count, URL preservation, and editorial team readiness, not framework choice.

A definitive 4-year Total Cost of Ownership (TCO) analysis, real-world Core Web Vitals benchmarks, Astro 7 GraphQL APQ architecture, and a 10-point executive decision matrix for choosing between decoupled and traditional WordPress.

The Shopify Plus vs WooCommerce headless decision in 2026 is no longer a binary "platform vs custom" trade-off. Both can run headless, both integrate AI, both ship at the edge. The real axes are control, total cost over five years, and exit strategy. This article walks the matrix with confirmed platform facts.