Authentication

Authentication

You can use your username and password to generate an access token.

$client->post('https://api.travelconnectionleisure.com/v1/oauthorize/token', [
  'json' => [
    'grant_type' => 'password',
    'username' => '[email protected]',
    'password' => '..'
  ]
]);

Upon success, this will return the following:

{
    "status": "success",
    "access_token": "abc123",
    "refresh_token": "xyz789",
    "token_type": "bearer",
    "expires_in": 3600
}

You may then use access_token to authenticate future requests within the Authorization: Bearer .. header.

$client = new Client([
  'base_uri' => 'https://api.travelconnectionleisure.com/v1/',
  'headers' => [
    'Authorization' => 'Bearer abc123'
  ]
]);