If you prefer to authenticate and generate your access tokens via your own website or web application you can do so by making a POST request to the endpoint listed below. Be sure to send the required parameters when making an authentication request.
{primary} Regardless of how you generate your access tokens, all tokens generated are saved on the authenticated users RoadLeagues account. You can manage all your created access tokens directly from within your RoadLeagues account.
| Method | URI |
|---|---|
POST |
https://roadleagues.com/api/v1/authenticate |
"name" : "{NAME}" // Optional - String
"email" : "{EMAIL}" // Required - String
"password" : "{PASSWORD}" // Required - String
{
"access_token" : "eyJ0eXAiOiJKV1QiLCJhbIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvcm9hZGxlYWd1ZXMuZGV2XC9hcGlcL3YxXC9hdXRoZW50aWNhYXQiOjE1ODU2NTkzNjIsIm5iZiI6MTU4NTY1OTM2MiwianRpIjoicjV6OFh1WmRSRDN2cVFUTyIsInNiI6MSwicHJ2IjoiODdlMGFmMWVmOWZkMTU4MTJmZGVjOTcxNTNhMTRlwNDc1NDZhYSJ9.TFl7oIxlDCYaAmbUaxMVGMgUkrp4Y9Y0W9zFPdtxY2s",
"token_type" : "bearer",
"expires_in" : "Never",
"status" : "success"
}
{primary} A couple of examples using
Ajax&PHP cURLon how you might go about making aPOSTrequest for this endpoint. Remember to replace the placeholders with your own credentials.
$.ajax({
type: "POST",
url: "https://roadleagues.com/api/v1/authenticate",
data: {
"name": "{NAME}",
"email": "{EMAIL}",
"password": "{PASSWORD}",
},
dataType: "JSON",
cache: false,
success: function (data) {
console.log(data);
}
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://roadleagues.com/api/v1/authenticate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "name={NAME}&email={EMAIL}&password={PASSWORD}",
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;