Token Exchange
Exchange the authorization code for an access token from your server.
Request
HTTP
POST https://api.sloxly.com/v1/Oauth/token Content-Type: application/x-www-form-urlencoded
Parameters
| Parameter | Required | Description |
|---|---|---|
client_id | Yes | Your OAuth client ID |
client_secret | Yes | Your OAuth client secret |
code | Yes | The authorization code from callback |
Response
JSON — Success (200)
{
"status": "success",
"access_token": "slx_at_abc123...",
"token_type": "Bearer",
"expires_in": 3600
}PHP Example
PHP
$ch = curl_init("https://api.sloxly.com/v1/Oauth/token"); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => http_build_query([ 'client_id' => $client_id, 'client_secret' => $client_secret, 'code' => $_GET['code'], ]) ]); $response = json_decode(curl_exec($ch), true); $accessToken = $response['access_token'];
Never expose your
client_secret in client-side code. Always make this request from your server.