API LIBRARY
Collapse Sidebar Menu
Expand Drawer

Authentication in WebApi

To authenticate with the Web API protocol, you will need the username and password for your account. Execute a POST to https://api-prod.corelogic.com/trestle/oidc/connect/token with the following form fields:

grant_type = client_credentials
scope = api
client_id = [your feed user ID]
client_secret = [your feed password]

Execute the query demonstrated below, and store the value of the token. The token has an expiration period of 8 hours.

On subsequent queries, provide the HTTP header:
Authorization: Bearer [TOKEN VALUE]

Examples

Code Example

curl -X POST \
--output "token.json" \
-H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" \
-k -d "grant_type=client_credentials&scope=api&client_id=[username]&client_secret=[password]" \
'https://api-prod.corelogic.com/trestle/oidc/connect/token'

Result

{
    "access_token": [token],
    "expires_in": 28800,
    "token_type": "Bearer"
}

Code Example

<?php

$request = new HttpRequest();
$request->setUrl('https://api-prod.corelogic.com/trestle/oidc/connect/token');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
    'cache-control' => 'no-cache'
));

$request->setContentType('application/x-www-form-urlencoded');
$request->setPostFields(array(
  'client_id' => '$username',
  'client_secret' => '$password',
  'grant_type' => 'client_credentials',
  'scope' => 'api'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

Result

{
    "access_token": [token],
    "expires_in": 28800,
    "token_type": "Bearer"
}