oAuth 2.0 authentication with the Tracka API

Back to all articles

This guide goes over how to get a bearer token to use with the Tracka API. Tracka uses the oAuth 2.0 standard for authentication.

Step 1: Authorization

Direct the user to the following URL with the parameters set to your environment. After the user approves or denies the request, they will be sent to the callback URL. The callback URL must be set in the application settings.

GET /external/v1/auth/authorize?client_id=<CLIENT ID>&scope=<SCOPES>&response_type=code&redirect_uri=<URL ENCODED CALLBACK URL>
Host: api.tracka.sport
Accept: */*

Step 2: Getting the bearer token

Send a POST request to https://api.tracka.sport/external/v1/auth/token

POST /external/v1/auth/token
Host: api.tracka.sport
Content-Type: application/json
Accept: */*
Content-Length: 1027
{
	"grant_type": "authorization_code",
	"client_id": "<CLIENT ID>",
	"client_secret": "<CLIENT SECRET>
	"code": "<CODE FROM THE CALLBACK URL>",
    "redirect_uri": "<CALLBACK URL USED WHEN AUTHORIZING>"
}

Step 3: Testing by getting the current user

Send a GET request to https://api.tracka.sport/external/v1/me with the following headers

GET /external/v1/me
Host: api.tracka.sport
Accept: */*
Authorization: Bearer eyJ0eXAiOiJKV1Q...