Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If your client will interact with PKB on behalf of a computer system, rather than a person, then you need to use the Client Credentials Grant workflow.An example of that scenario would be a hybrid mail provider, making use of ourread receipt API.

The organisation you wish to send/receive data for must have granted you authorisation before you will be able to make an API call, but you are able to obtain an access token independently of whether or not any such permissions have been granted.

Note: these examples are written for http://sandbox.patientsknowbest.com - replace the URL as needed if you are connecting to a different environment.

Client uses client ID and client secret to obtain an access token

...

When you were established as a PKB partner, you will have been issued with a client ID and a client secret. You use these to obtain an access token when you need one.

POST https://oauth2.sandbox.patientsknowbest.com/api/oauth/tokenThe request must be made as a POST to the token endpoint. The URL of the token endpoint will vary depending on:

  • The environment you are connecting to (e.g. sandbox, UK production, EU production, etc.)

  • The API endpoint that you are calling (the Facade and Messaging FHIR endpoints share one token endpoint, which differs from the token endpoint for the Customer and Aggregated FHIR endpoints)

Please see the Connectivity page for details.

Parameters

Parameter

Type

Optionality

Description

Example

grant_type

Form parameter

Required

Must be "client_credentials"

client_credentials

Authorization

HTTP header

Required

This is a standard HTTP basic authorization header.

The value should be a Base64 encoding of your client ID and client secret, concatenated together with a colon (:) separator, and prepended with "Basic ".

For example, if your client ID was example_client_id and your client secret was example_secret then your header value should be:

Basic ZXhhbXBsZV9jbGllbnRfaWQ6ZXhhbXBsZV9jbGllbnRfc2VjcmV0

ZXhhbXBsZV9jbGllbnRfaWQ6ZXhhbXBsZV9jbGllbnRfc2VjcmV0

Content-Type

HTTP header

Required

Must be "application/x-www-form-urlencoded"

application/x-www-form-urlencoded

...