oauth

Create an oauth token

Changed on

Create an OAuth 2.0 Bearer token. A valid bearer token is required for all other API requests.

Be sure to set the header Content-Type: "application/vnd.api+json". Otherwise, you will get an error 403 Forbidden. Using Content-Type: "application/json" is permitted (to support older oauth clients) but when using application/json the body should have a body in the following format instead of nesting under data.attributes:

{
  "grant_type": "client_credentials",
  "client_id": "95c78ab2-167f-40b8-8bec-8398d4b87454",
  "client_secret": "35d18dc9-a3dd-4948-b787-063a490b9354"
}
post/oauth/token

Request

  • Base URL
    https://api.twinehealth.com/pub
  • Auth
    OAuth 2
    Client credentials
    Token URL: /oauth/token scopes: group, organization

Query parameters

include'groups' | 'organization'

List of related resources to include in the response

Request body

Example request

{
  "data": {
    "type": "oauth/token",
    "attributes": {
      "grant_type": "client_credentials",
      "client_id": "95c78ab2-167f-40b8-8bec-8398d4b87454",
      "client_secret": "35d18dc9-a3dd-4948-b787-063a490b9354"
    }
  }
}

Response

Created

Example response

{
  "meta": {
    "req_id": "2de51f1a-bafa-4e48-a0d0-cd8d4a9ffb28"
  },
  "data": {
    "type": "oauth/token",
    "id": "5817a24d678a7c2cbf5df3ee",
    "attributes": {
      "access_token": "c1b83534-76c1-4a27-b1d4-8140e24dd7c6",
      "refresh_token": "a38d192a-76fd-4b1d-954c-893c9d29c8f4",
      "token_type": "bearer",
      "expires_in": 3601
    },
    "relationships": {
      "groups": {
        "data": [
          {
            "type": "group",
            "id": "5755db2a3db4179179999acf"
          }
        ],
        "links": {
          "related": "/pub/oauth/token/5817a24d678a7c2cbf5df3ee/groups"
        }
      }
    }
  }
}

Changes

    • info

      the endpoint scheme security OAuth2 was added to the API

    • info

      the endpoint scheme security twine_auth was removed from the API