401 when calling Token URL PDS Service


I am looking for some advice regarding getting the JWT from the integration environment.

I am running the example code from GitHub .

I have also set up the application with access to the PDS service.

However I am getting a 401 when calling the following token URL https://int.api.service.nhs.uk/oauth2/token

As I understand 401 indicates a issue with the API key or the header.

error code
Access token is missing 401 (Unauthorized)
Access token is invalid 401 (Unauthorized)
Access token has expired 401 (Unauthorized)
kid header is invalid 401 (Unauthorized) invalid_request Invalid ‘kid’ header in client_assertion JWT - no matching public key

The Application ID is b877120a-235b-4613-9cec-a1f9cceb6006

Can you advice how best to identify what the issue is?

Hi @williamaitchison

Thanks for your query.

Can you message me directly with your:

  • Full request (Please include GET, POST, PUT, host, path, query parameters, request headers and request body where applicable)

  • Full response (Please provide response headers, response code/reason phrase, response body)

  • Your JWT

Kind regards,

Hi @williamaitchison

Is this issue resolved?

If you still require assistance, please DM me the requested details to enable our support team to troubleshoot further.

Kind regards,

Hi @ernest.kissiedu1,

The issue was due to the Key missing the KID. I have regenerated the Key and can now connect to the service. Thank you for your help.



1 Like