Next.js developer in Łódź

Next.js for businesses in Łódź, delivered remotely by one developer.

Next.js developer

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.

My WordPress.org profile

Connecting a Next.js service to login.gov.pl is an administrative process and a protocol job in one. The Ministry of Digital Affairs publishes the documents, and they set the order: application, test stage, application for production, certificates. I am not a lawyer and not part of the Ministry. This page follows the official documents on gov.pl and puts each step where it belongs in a Next.js app.

Facade on Piotrkowska Street in Łódź

A facade on Piotrkowska Street in Łódź. Image: Adam Jones from Kelowna, BC, Canada, CC BY-SA 2.0, via Wikimedia Commons.

#What is login.gov.pl?

The Ministry’s documentation page calls it the Węzeł Krajowy, the national node. The conditions of connection define it as an organisational and technical solution that lets a service authenticate a user with an electronic identification means issued in a connected system, directly or through the cross-border node. Profil Zaufany is defined there as one such means. The service that asks for the identity is the Dostawca Usług (DU), the service provider, and the system that issues the means is the Dostawca Środka Identyfikacji.

The Ministry’s page for integrators says what the node returns: at least the minimum data set from the eIDAS implementing regulation, which is the current family name, the current first name, the date of birth and a unique identifier. The data are encrypted. The node itself stores no personal data, except what is needed to reconstruct the exchange of messages after an incident.

#Which services must connect?

The questions and answers document (annex 6) lists them. Public entities’ systems that provide online services must join, by dates set in the 2018 amending act: new systems launched in 2021 or later join at once. An online service is one done over the internet, for a public entity, that requires authentication with an identification means at a stated assurance level of low, substantial or high. The document says systems will not be connected when they offer no service requiring identity at least at the low level, or when they only authenticate the entity’s own staff, which is not treated as a service.

For a private Lodz company this matters in a different way. The conditions of connection (annex 1, version 3.7 of 23 March 2026) call the applicant a “podmiot” and define it as a public or commercial entity that applies for access to the integration and production environments. The integrator instruction says the node is available to public entities under login.gov.pl and to private entities under podmiotyzewnetrzne.login.gov.pl. Acceptance is the ministry’s decision in the application, so ask before you plan a launch date.

#How does the application work?

Annex 1 describes two stages through the portal Współpraca Cyfrowa Tożsamość.

Stage 1, test environment. You fill in a letter on the portal with the institution’s data, the system’s data, the integration coordinators and attachments. Persons entitled to represent the institution sign it with a trusted or personal signature. You then receive the data for a SAML 2.0 integration: certificates, an issuer, passwords and test scenarios. When the work is done you confirm it on the portal, and the Centralny Ośrodek Informatyki (COI) prepares a test report. The document forbids performance and load tests on the test environment unless COI asks for them.

Stage 2, production. The application for connection must be signed with a qualified signature by persons entitled to represent the institution. After consent you upload two certificates that you buy yourself: one to validate the messages you sign for SSO and SLO, and one that login.gov.pl uses to encrypt the assertion data for you. When COI finishes the configuration, the case status changes to “Podłączono”. Changes to the data later are reported in signed documents, with a qualified signature for production changes.

#How does the SAML flow work?

The integrator instruction (annex 2) describes four parties: the browser, your service as Service Provider, login.gov.pl as Identity Provider, and the identity provider behind it. The flow it describes:

  1. Your service builds a SAML AuthnRequest and returns an HTML form that posts it to login.gov.pl, with the request base 64 encoded in a hidden field named SAMLRequest.
  2. The user chooses an identification means and signs in there.
  3. login.gov.pl sends the browser back to your assertion consumer URL with an artifact.
  4. Your service calls the ArtifactResolve web service of login.gov.pl, signed, over SOAP, and gets the assertion.
  5. The assertion is encrypted with your public key. You decrypt it, read the user data and create your own session.

The instruction states the point of the artifact binding: the sensitive data do not travel through the browser. The request and the artifact still go through the browser by POST.

The example AuthnRequest in the instruction carries AssertionConsumerServiceURL, Destination, ForceAuthn, ProtocolBinding set to HTTP-Artifact, ProviderName and an Issuer. For a private entity the request must carry the SPType value private, and for a public one public. The instruction states that messages must be constructed identically to its examples, including value formats and element order.

#Which signing and encryption rules apply?

The instruction is specific, and a Node.js developer should read it before choosing an XML library:

  • Requests to login.gov.pl are signed with ECDSA with SHA-256 on the NIST P-256 curve. The unsafe SHA-1 hash is forbidden.
  • The service needs separate private keys for decrypting assertions and for signing XML messages.
  • login.gov.pl encrypts assertion data with AES-256-GCM, wraps the key with AES-256-KW and agrees the key with ECDH-ES.
  • Production certificates must be X.509 v3, bought from a qualified trust service provider, with the Digital Signature extension for signing, Key Agreement for decryption, and OCSP and CRL addresses.
  • Signed envelopes break easily. The instruction lists extra white space before or after signing and a wrong Signature structure as the usual causes of an “invalid signature” error, and says ds:Reference URI is the most common problem.

The instruction notes that login.gov.pl is built in Java, and the wording is Java-oriented. I have not verified any particular Node.js library against this profile, and I would build the signing step against the instruction’s examples on the test environment before anything else.

#How does the test environment work?

The instruction says the test environment is int.login.gov.pl, with metadata at https://int.login.gov.pl/login/metadata. You email the IP addresses your system connects from, the system name, the SAML issuer and one assertion consumer URL to COI, which returns certificates. Your system is activated the first time it sends an AuthnRequest. A “Dostęp zabroniony” error means it was not activated, and the instruction lists what to check: the issuer, the provider name, and white space around the signature. It advises an issuer without special characters, Polish letters or spaces.

The metadata describe the single sign-on service with the HTTP-POST binding, the artifact resolution service over SOAP, the name ID formats persistent, transient and unspecified, and the requestable attributes. The attribute list in the sample includes PersonIdentifier, DateOfBirth, FirstName, FamilyName, BirthName, CurrentAddress, Gender and PlaceOfBirth. The instruction adds that a declared attribute does not guarantee that an identity provider delivers it.

#Where does each step live in Next.js?

The Next.js documentation fixes where server code can run. A Route Handler supports GET and POST, reads a posted form with request.formData(), and can export runtime = 'nodejs'. The cookies function sets cookies in a Route Handler or Server Function, and HTTP does not allow setting cookies after streaming starts.

StepNext.js place
Build and sign the AuthnRequest, return the auto-posting formRoute Handler at app/auth/login/route.ts
Receive the artifact on the assertion consumer URLPOST Route Handler at app/auth/acs/route.ts
Call ArtifactResolve, decrypt the assertionserver function called from that handler
Create the session cookiecookies().set in the same handler
Logout request with NameID and SessionIndexRoute Handler, after reading the stored values
// app/auth/acs/route.ts
export const runtime = 'nodejs'

export async function POST(request: Request) {
  const form = await request.formData()
  const artifact = form.get('SAMLart') // field name: confirm against the instruction examples
  if (typeof artifact !== 'string') return new Response('Bad request', { status: 400 })
  const user = await resolveArtifact(artifact) // signed SOAP call, then decrypt the assertion
  await createSession(user) // sets the cookie with cookies() and stores the NameID and SessionIndex
  return Response.redirect(new URL('/account', request.url), 303)
}

The field name in the sample is my assumption from the SAML artifact binding, and the instruction shows only the artifact value, so confirm the name in the test environment.

The Next.js authentication guide advises that a session payload carry minimal unique user data and no personally identifiable information. The identifier from login.gov.pl is personal data, so keep it in your database and put an internal user ID into the cookie. The guide also recommends checking the session close to the data, not only in a layout.

For logout, the instruction says the service sends a LogoutRequest to the node with the NameID and SessionIndex from the earlier assertion. Store both with the session.

Test one case in staging: the node posts the user back from another site. Do not make the callback depend on a session cookie that the browser may not send on that request. Keep the pending request ID in a server-side store and match the response to it.

#What does the e-dowód have to do with it?

Nothing that the documents say. I searched the integrator instruction, the conditions of connection and the questions and answers for it and found no mention. Which identification means appear on the node is a matter for the node and its identity providers. A service that needs an assurance level states it in the request, and what users can sign in with follows from that.

#Where does a login.gov.pl integration start?

It starts with the question of whether your service qualifies and which entity files the application. Send the entity type, the system name, the assurance level you need and who can sign with a qualified signature through the contact page. I answer with a written plan for the two stages and the Next.js work in between, and that first plan costs nothing. Other App Router work is described on the Next.js developer page.

Need this service: Next.js developer in Łódź?

Describe your project by e-mail. I reply within 24 hours.

Describe your project

Explore other WordPress services and knowledge base