Technical specification
This technical specification explains the content of the OS OAuth2 API.
If you are not familiar with the OS OAuth 2 API please read the overview documentation before proceeding.
API reference
Generating an access token
To create an access token, you must send a HTTP POST request to the OS DataHub OAuth 2 token endpoint. The endpoint is secured with HTTP Basic Authentication, where the username is the Project API Key and the password is the Project API Secret.
OAuth 2 Token Endpoint
Required HTTP Headers
Name | Value | Description |
---|---|---|
Authorisation |
| The encoded credentials are a base-64 encoded version of a string containing the username (Project API Key), a single |
Content-Type |
| The request body must be form-encoded. Many HTTP frameworks have support for form-encoded messages and will set the content type automatically. |
Request body
The request body must be form-encoded with the following property:
Name | Value | Description |
---|---|---|
|
| The only supported grant_type is |
Response body
The response body is returned as a JSON object with the following properties:
Name | Example Value | Description |
---|---|---|
|
| The new access token. |
|
| The time until the token expires, in seconds. |
|
| The time at which the token was created. |
|
| The type of the token. This is always |
Using the access token
Once you have generated your access token, you can use it to authenticate your requests to other OS Data Hub APIs.
To use the access token you must include an Authorization header on your API request. The value of the Authorization header should be 'Bearer', a space, and then the access token, for example, Bearer <
accessToken
>
.
Last updated