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.
- Local WordPress meetup: WordPress Málaga
A browser asks for a client certificate during the TLS handshake, before any page loads. When the user holds a certificate from the Fábrica Nacional de Moneda y Timbre (FNMT), the server can learn who they are without a password. I am based in Gdynia and work with clients remotely and in writing. The Next.js code that consumes the certificate is mine to build. Whether a certificate login is enough for your use case is a legal and organisational decision for you.

The Alcazaba of Málaga, captured by Diego Delso and licensed CC BY-SA 4.0, from Wikimedia Commons.
What is the FNMT user certificate?
The FNMT website describes the Certificado electrónico de Ciudadano as an electronic certification issued by FNMT-RCM that links the subscriber to signature verification data and confirms their identity. It is also known as the Persona Física or User certificate. FNMT says it lets the holder identify themselves on the internet and exchange information with people and bodies, and lists uses such as filing taxes, municipal register queries and signing forms, with public administrations and private entities.
FNMT says any Spanish or foreign citizen of full age, or an emancipated minor, who holds a DNI or NIE can request it free of charge. There are four ways to get the certificate as a file on a computer or mobile device: video identification, in person at an office, with the DNIe, or with a mobile device. FNMT also notes that access to secure pages requires a browser that has the certificate installed.
For your app this means the user brings the credential. You do not issue it, and you do not see a password.
Which certificates does a company use?
For legal persons FNMT issues three types of representative certificate, qualified under Regulation (EU) No 910/2014 on electronic identification and trust services. FNMT adds a warning: representatives who are the sole or joint administrator of the entity must not request the legal person representative certificate. They need the administrator certificate instead.
A login that should identify a person acting for a company therefore has to decide which certificate types it accepts and what the certificate says about the represented entity. I did not verify the field layout of each type from FNMT’s pages, so read the FNMT certification practice statement, linked from the sede, before you map fields to accounts.
Which root certificates does the server trust?
FNMT publishes a download page for its root certificates, with SHA-1 fingerprints so you can check what you downloaded. The user-facing chain has AC Raíz FNMT-RCM as the root, with subordinates including AC FNMT Usuarios and AC Representación. The same page lists other subordinates, such as AC Componentes Informáticos and AC Sector Público, and an expired AC Administración Pública. A second group of root certificates covers secure servers.
Decide which certificates you accept, then trust only the CAs that issue them. Compare the fingerprints on the page with the files you load, through a channel you control.
How does Node.js read a client certificate?
The Node.js TLS documentation defines the pieces.
- requestCert: if true, the server requests a certificate from connecting clients and attempts to verify it. The default is false.
- rejectUnauthorized: if not false, the server rejects any connection that is not authorized against the supplied CAs. It only has an effect when requestCert is true, and the default is true.
- ca: overrides the trusted CA list. When specified, the default list is completely replaced, not extended.
- tlsSocket.authorized: true if the peer certificate was signed by one of the CAs given when the socket was created.
- tlsSocket.authorizationError: the reason a certificate was not verified, set only when authorized is false.
- tlsSocket.getPeerCertificate(): returns an object for the peer certificate, an empty object if the peer sent none and null if the socket is destroyed.
Two details matter for login. The documentation says the peer certificate is only verified during a full TLS handshake, and that on TLS 1.3 a resumed session where the client presented no certificate is no longer reported as authorized, starting with v26.8.0. Check authorized on every request and treat an empty certificate object as no identity. I did not find a statement in what I read about how Node.js checks revocation, and I did not verify how FNMT publishes revocation status, so treat revocation as an open item to settle from FNMT’s documentation.
How does the certificate reach Next.js?
The client certificate is checked in the TLS layer, below the Next.js request handler, and the Next.js documentation pages I read describe no client-certificate setting. The documented way to run your own server is a custom server, and the Next.js documentation says to use one only when the integrated router cannot meet your requirements. It also states that standalone output mode does not trace custom server files, so the two cannot be used together. A separate proxy in front of next start is the other route, and the same Node.js TLS options apply to a proxy written in Node.js.
A sketch with a custom server that terminates TLS, verifies the certificate and passes a fingerprint to Next.js in a header:
// server.mjs (sketch, not production code)
import { createServer } from 'node:https'
import { readFileSync } from 'node:fs'
import next from 'next'
const app = next({ dev: false })
const handle = app.getRequestHandler()
await app.prepare()
createServer(
{
key: readFileSync('server-key.pem'),
cert: readFileSync('server-cert.pem'),
ca: readFileSync('fnmt-trusted-chain.pem'),
requestCert: true,
rejectUnauthorized: false, // lets anonymous visitors reach public pages
},
(req, res) => {
delete req.headers['x-client-cert-fp'] // never trust a copy from the client
const socket = req.socket
const peer = socket.getPeerCertificate()
if (socket.authorized && peer && peer.fingerprint256) {
req.headers['x-client-cert-fp'] = peer.fingerprint256
}
handle(req, res)
}
).listen(443)With rejectUnauthorized set to false, a visitor without a certificate still gets public pages, and protected routes check the header. With true, Node.js drops every connection without a valid certificate, which suits an app that is entirely behind the certificate. The choice is about the user experience on the first visit, and both are documented behaviour.
On the Next.js side, the headers function reads incoming request headers in a Server Component or Route Handler. It returns a read-only object and opts the route into dynamic rendering, according to the Next.js documentation.
// app/account/page.tsx (sketch)
import { headers } from 'next/headers'
import { redirect } from 'next/navigation'
export default async function Account() {
const fp = (await headers()).get('x-client-cert-fp')
if (!fp) redirect('/login-required')
// look up the account bound to this fingerprint or subject
return <h1>Account</h1>
}A fingerprint identifies a certificate, not a person. When a certificate is renewed, the fingerprint changes. A real design binds an account to the certificate subject data once, after the user proves control, and handles renewal. Which subject field to bind is the open item from the section on company certificates.
How do sessions work after the handshake?
The handshake proves possession of the private key at connection time. It does not give you a session. After the first verified request, create an app session cookie in a Route Handler, because cookies can be set in Route Handlers and not while a Server Component renders, as the Next.js documentation states. Set httpOnly and secure, and a short lifetime. Keep the header check for sensitive actions, so a session cookie alone does not outlive a certificate that was removed.
What breaks in practice?
- A user may have several certificates installed and be asked to choose one. Explain on the page what is being asked.
- Test the browsers and mobile devices your users actually have, including any in-app browser.
- If the proxy or CDN in front of your server terminates TLS, the certificate never reaches your Node.js process. The proxy must verify it and pass a trusted value on, or TLS must pass through.
- Anyone who can reach the Next.js process directly can send the identity header. Bind it to localhost or a private network.
Checklist for certificate login in Next.js
- List the certificate types you accept: Ciudadano, representative types, others.
- Download the FNMT chain from the sede, compare the fingerprints and build the trust file.
- Set requestCert, a restricted ca list and a deliberate rejectUnauthorized value.
- Check authorized on every request and treat an empty certificate object as anonymous.
- Strip the identity header from client requests and set it only after verification.
- Decide which subject field binds an account and how renewals are handled.
- Settle revocation checking from FNMT documentation before go-live.
- Keep Next.js reachable only from the front server.
How does a project run?
- You send who the users are, which certificate types you accept and how the app is hosted today.
- I write down the scope and my assumptions, including the questions that need FNMT documentation or your adviser.
- I build on a staging copy with test certificates, and you try the login in the browsers your users have.
- After written acceptance, I move it to production hosting that you control.
I need repository and hosting access. Next.js services beyond this topic are on the Next.js developer page.
Certificate login for a Málaga project
If a Málaga team wants certificate login in front of a Next.js app, write through the contact form with the certificate types, the user groups and your current hosting. The first written estimate for the Next.js build is free, and the open FNMT questions go back to you with a short list.
Selected projects
Examples of my work.
frems.pl - WordPress Project | WPPoland
The website frems.pl is a modern online platform presenting the offer of the manufacturer and distributor of medical equipment specializing in FREMS technolo...
funderwear.pt - Premium Underwear E-commerce Platform
Funderwear.pt is a WooCommerce online store that meets the needs of even the most demanding customers looking for unique gifts or wanting to treat themselves to premium, fun-designed underwear.
Healthcare Website: fermentum-mobile.pl
The website fermentum-mobile.pl is a dedicated platform created for fermentation enthusiasts who wish to explore traditional processing methods and discover ...
WordPress support & development in Málaga
Need this service: Next.js developer in Málaga?
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.