User-restricted NHS CIS2 separate authentication and authorisation - Java tutorial

Good day,

I am busy with the User-restricted NHS CIS2 separate authentication and authorisation - Java tutorial.

I’ve registered an application and configured the environment variables as specified. Below is a screenshot of the variables:

I can see that I receive an ID Token when I debug the API, but I receive an HTTP 401 when trying to retrieve the access token.

I have confirmed that:

  • The JWT format is correct with the issuer and subject being set the the API Key from the developer portal.
  • That the JWT signature is correct (I verified the signature with the private key)
  • The private key is loaded correctly

Does anyone else have the same issue?

And is the SERVICE_OAUTH_ENDPOINT=https://sandbox.api.service.nhs.uk/oauth2-mock correct? According to the readme, I must enter a username and password, but the login screen only has a username.

Hi, unfortunately there are known issues with the sandbox environment, can you please reach out to the API-M team for support, they will be able to tell you why you are getting a 401.

Thanks for letting me know, John. I’ll reach out to them.