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 Scottish public service that adds ScotAccount hands the sign-in screen, the two-factor step and account recovery to someone else. What stays with the service is everything after the user returns: the session, the checks on each page and each form submission, and what the service does with identity data when it asks for it. This page is about that second half in Next.js, and about what the ScotAccount service manual does and does not publish.

The Finnieston Crane on the north bank of the Clyde in Glasgow. Image credit Rosser1954 under CC BY-SA 4.0, via Wikimedia Commons.
What is ScotAccount?
The ScotAccount service manual presents it as a secure and simple way to access online public services in Scotland. One account lets a user sign in to several services. The home page says the team is inviting public services in Scotland to join, and that an organisation can contact them to join the test environment.
The features page splits the offer into two parts. The first is authentication: ScotAccount signs in and authenticates each new and returning user, so the service does not have to. Users need an email address and a phone number to create an account and sign in with two-factor authentication, and the page lists self-service password reset and recovery. The second part is optional identity verification, covered below.
That division decides what a Next.js team builds. There is no password form, no reset flow and no second-factor screen to write. There is a hand-off to ScotAccount, a return, and a session of your own.
Can I read the ScotAccount technical documentation?
Only after contact. The documentation page says the documents help you understand the OpenID Connect (OIDC) authentication protocol the service uses and how to integrate ScotAccount with your service in a test environment. It also says the team is working on a new way to publish them and that, for now, you speak to them to get access to the current technical documentation. Requirements are worked through in initial discussions and workshops.
For this page that means a clear limit. The manual names the protocol, OpenID Connect, but the endpoints, scopes, claims and any client registration details are in the material the team shares with an onboarded organisation. I do not repeat them here and do not guess them. A Next.js integration is written against those documents, not against a generic OIDC tutorial.
How does onboarding work?
The get started page describes three steps:
- Contact the team to check your service in the test environment.
- Test and integrate ScotAccount.
- Agree timing for the production connection and go-live.
The page says the service can be an existing one with current users or one still in development. Before test access you agree a brief terms of engagement. Once you have tested and want to use ScotAccount, the team discusses timing for connecting to production. The page links to a beta page for eligibility criteria and what to expect, and gives no timelines, so a project plan cannot assume any.
Does ScotAccount verify identity?
If the service needs it, yes. The features page says verification is optional and that you have to use the ScotAccount sign-in to verify the identity of your users. Users do not need to download an app or extra software.
The online identity verification page describes the flow:
- Your service asks ScotAccount to verify a user’s identity, and the user consents.
- The user submits details. ScotAccount checks that the identity exists and shows no indicators of fraud.
- The user completes one of two routes: images of ID and face, or answers to questions about themselves.
- ScotAccount returns the user to your service with a result of verified or unverified. If verified, it provides name, date of birth and address.
The page states that verified data is sent only when the user consents to sharing it. The roadmap page lists a verification route built with HM Passport Office as launched, and says plans may change because the programme is agile. It gives no dates.
For a Next.js build, the unverified result is a normal outcome, not an error. The page that receives it needs a screen with a next step, not a stack trace.
What should the Next.js session store?
The Next.js authentication guide separates authentication, session management and authorization. ScotAccount takes the first. The other two stay in the app.
The guide offers stateless sessions, where data or a token sits in a cookie, and database sessions, where the browser holds only an encrypted session ID. For the cookie it recommends HttpOnly, Secure, SameSite, an expiry and a path, set on the server with the cookies API.
On the payload the guide is direct: it should contain the minimum, unique user data used in later requests, such as a user ID or role, and not personally identifiable information like a phone number or an email address. That matters here, because a verified ScotAccount result carries a name, date of birth and address. Those belong in a protected store, if the service needs to keep them at all, and not in a cookie that travels with every request.
A sketch in the shape the guide uses, with only an opaque subject and a verified flag in the cookie:
// app/lib/session.ts
import 'server-only'
import { cookies } from 'next/headers'
export async function createSession(subject: string, verified: boolean) {
const expiresAt = new Date(Date.now() + 60 * 60 * 1000)
const value = await encrypt({ subject, verified, expiresAt })
const store = await cookies()
store.set('session', value, {
httpOnly: true,
secure: true,
sameSite: 'lax',
expires: expiresAt,
path: '/',
})
}Here encrypt is a signing helper as in the guide. The one hour lifetime is an example for the sketch. The right value comes from the service owner and the ScotAccount documents.
Where should the checks run?
The guide recommends a Data Access Layer: one server-only module with a verifySession() function that checks the session and redirects or returns what later requests need. It calls Proxy an option for optimistic checks that read only the cookie, and warns that Proxy should not be the only line of defence. Most checks belong close to the data.
Two cautions from the same guide apply directly to a public service. Layouts do not re-render on navigation, so an auth check placed only in a layout does not run on every route change. And Server Actions should be treated like public endpoints: each one verifies the caller itself, because a check on the page that renders the form does not cover it.
ScotAccount does not change this. It answers who the user is. Whether that user may open a given case file or submit a given form is a decision the service makes, per request, on the server.
What does the Next.js side need before a test environment?
Not much, and that is the point of asking early. A useful starting list:
- a route that receives the user after sign-in and a route that starts it, both server-side
- a server-only session module and a Data Access Layer as above
- a decision on what, if anything, is stored after a verified result, and where
- a screen for unverified and cancelled outcomes
- environment variables for credentials, read only on the server, since the Next.js docs say variables without the
NEXT_PUBLIC_prefix are not available in the browser
Everything specific to ScotAccount, such as redirect URIs, keys and claims, waits for the documents the team provides.
Planning a ScotAccount front end
If your Glasgow team is preparing a service that should sign users in with ScotAccount, send the service description, whether it is live or in development, and whether you need identity verification through the contact page. The first written estimate is free and covers the Next.js session and checks, not the ScotAccount onboarding, which only the ScotAccount team can grant. Background on the work is on the Next.js developer page.
Selected projects
Examples of my work.
E-commerce Development: eclipsesource.com
EclipseSource, founded in 1997, is a global leader in Eclipse technologies, with a strong presence in Europe and North America, specializing in enterprise so...
E-commerce Development: estel-poland.com
estel-poland.com is a professional online store for cosmetics, created for customers seeking high-quality skincare and makeup products. The platform is desig...
E-commerce Development: gdasj.pl
gdasj.pl is a local website from Gdansk, built for simple publishing, good performance, and clear access to content.
See also in Great Britain
Need this service: Next.js developer in Glasgow?
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.