Authentication

Traity REST API uses OAuth 2.0 authentication using your application's key and secret for client credentials authentication.

To get an app's key and secret, you need to log in to your Traity for Developers dashboard, create an app, and you'll find your app's key and secret in your app's details page.

1. Ask for authorization to the user

Redirect users to request Traity access:

GET https://auth.traity.com/oauth/authorize

Parameters

Name Type Description
client_id string Required. The client ID you received from Traity when you registered.
state string An unguessable random string. It is used to protect against cross-site request forgery attacks.

2. Receive an authorization code

If the user accepts your request, Traity redirects back to the redirect uri (the one you have registered when creating the app) with a temporary code in a code parameter as well as the state you provided in the previous step in a state parameter.

3. Request the access token for that user

Exchange the authorization code for an access token:

GET https://auth.traity.com/oauth/access_token

Parameters

Name Type Description
client_id string Required. The client ID you received from Traity when you registered.
client_secret string Required. The client secret you received from Traity when you registered.
code string Required. The code you received in Step 2.

Response

The response will be a JSON containing the access token:

{ "access_token":"cQj1d2a3d634cn8cn1a7d2nccn3f8cnf1s8l29" }

4. Query the API

Once you have a token, pass an Authorization header with the Bearer keyword and the token in your HTTP request to query the API on behalf of your user:

GET /1.0/transactions/awrw0p4 HTTP/1.1
Host: trustapi.traity.com
Authorization: Bearer cQj1d2a3d634cn8cn1a7d2nccn3f8cnf1s8l29