INT testing with SSO - user restricted APIs all fail with 401

We’re able to do a combined single sign on against int ( https://int.api.service.nhs.uk ) and use the ../userinfo end point to get the SSO user’s UID,

The application ID in the onboarding portal is c28fcac0-a150-47bf-831a-8ae5955a20ca, access key TAWzmep6ArxavYWT3tfYbevj4RX3IvuU

The userinfo endpoint, post-SSO, is saying my nhsid_useruid is 555384914100

When I try and use the access token against the integration environment’s eRS service, I’m always getting a 401, “invalid access token” error for user-restricted APIs
Seems to happen from both our pre-live Node code and manually with Curl. Rotating the token and using a new one doesn’t seem to change this message.

There should be a record in the integration environments https://digital.nhs.uk/developer/api-catalogue/e-referral-service-fhir#get-/R4/PractitionerRole API for correlation id of dbe3b393-9607-4e65-a297- at 14:35 on the 30th, that failed.

Is there a way to get some insight as to why it might be failing ? We’re already onboarded for it, as we can access int-ers.nhs.uk directly through it’s own SSO.

And retrying today, I’m getting an error about an ASID ?

Correlation id ad087e73-718b-4a2b-a3d0-c50e5e03cf1 at 14:11

{
resourceType: 'OperationOutcome',
meta: {
lastUpdated: '2026-08-03T13:11:11.147Z',
profile: [ ' OperationOutcome - FHIR v4.0.1 ' ]
},
issue: [
{
severity: 'error',
code: 'forbidden',
details: [Object],
diagnostics: 'ASID is not configured in the application'
}
]
}
{
resourceType: 'OperationOutcome',
meta: {
lastUpdated: '2026-08-03T13:11:11.147Z',
profile: [ ' OperationOutcome - FHIR v4.0.1 ' ]
},
issue: [
{
severity: 'error',
code: 'forbidden',
details: {
coding: [
{
system: '``https://fhir.nhs.uk/CodeSystem/NHSD-API-ErrorOrWarningCode``',
code: 'ACCESS_DENIED'
}
]
},
diagnostics: 'ASID is not configured in the application'
}
]
}

Hi Tom, is this a new app, I think we had you down as 476f2265-5f93-4379-8472-571a36dbb459 before.

If you you create a new one, it wont work straight away, we need to setup and approve it.

OK ?

Well, we’ve got several now, because combined SSO only allows one redirect URL to be added in the onboarding portal, so we need one for (at least) each of day-to-day development, integration test and client acceptance domains.

I emailed the 3 additional ones to support.digitalservices@ under ref CS1576963 earlier today if you can see that issue and assist ?

Could you post them on here please also, I can’t see anything on the ticket.

We can support some but also do have a finite amount of resource, generally we provide x1 user and x2 app restricted per partner.

c28fcac0-a150-47bf-831a-8ae5955a20ca
645345af-769a-4b5d-be90-7f97c4a64d1f
51be99ce-ddae-4f6d-8928-66d432a4a1cf

But if we can only have a single user restricted application active at any one time in integration, is there a better way to manage this ?

Each of those application ids are tied to different call back URLs, so we we can’t reuse say the development application id in the client testing server because the URLs differ and the callbacks will fail.

Looking ahead to production, we’d then need an application id per-trust as well, as each trust is their own URL, so own callback.

I getting the feeling we’re fighting against some limits inside of the NHS systems here.
Are we meant to have built a generic call back handler, and use the state param to decode that back to the correct backend at our side, rather than adding a call back to each of our applications’ URLs ?
What do other SSO users do ?

@tc1

Hey Tom,

I’m not saying you can’t do it, and we’re to help where we can. My point is that if you were to create, say, 20 applications in INT, and every other partner adopted the same approach, it could create some operational and management challenges.

Let me take a look at what you’ve sent above and see if I can understand the issue and whether there’s a way we can address it. :+1:

A 401 Unauthorized error during INT testing with SSO usually points to an issue with the Access Token or claims verification. Based on our healthcare integration workflows, I suggest checking if the token contains the exact required scopes for user-restricted APIs, or if the signing certificate/public key in your INT environment has expired or mismatched.

Also, keep an eye on proxy or API gateway configurations; sometimes custom authorization headers get stripped during routing, which leads to missing Bearer tokens at the endpoint level. We frequently address these exact token and data security compliance challenges when building clinical architectures.

We have documented our technical roadmap, security parameters, and system verification protocols on our development overview page here: Custom Healthcare Software Development for Modern Healthcare Organisations. This might serve as a handy benchmarking checklist for your environment mapping. Hope this helps you trace the root cause!


Cheers Tony. We’re a little stuck on our current eRS project if we can’t actually call it in user contexts :wink:

There is no certificate or public key for combined SSO.

Our redirect URL seems to describe the right scopes ?
`hXXps://int.api.service.nhs.uk/oauth2/authorize?response_type=code&client_id=…&state=…&redirect_uri=https://foo.bar.baz.co.uk/api/oauth2&acr_values=AAL2_OR_AAL3_ANY"

No worries, we have a small back log - i’ll try and pick this up today, but need a seperate team to assist also, so might be a 2-3 days or so before the binding of the correct attributes is complete

@tc1 For speed I can re-purpose the ASID you previously had been allocated - in Live, they would be unique (per site, per app), if not and you want them to be seperate I can request x3 new ones. Both options will work in INT but appreciate you might want it looking’‘live-like’

I think it’s best if we keep it simple and wait for it to be done “right”.

Just to check I understand - all those three applications will get setup so integration SSO through them will return tokens usable against integration testing eRS.
And when we come to move forward to a live environment, we’d set up new applications and callback URLs for live SSO and eRS.