OAuth 2.0 Integration
Sloxly OAuth 2.0 lets users sign in to your application with their Sloxly account. This guide covers the complete integration flow.
Before starting, create OAuth credentials in the Developer Console.
How It Works
The OAuth 2.0 flow uses the Authorization Code grant type:
- Redirect — Your app redirects the user to Sloxly's authorization endpoint
- Login — The user signs in and approves your app
- Callback — Sloxly redirects back to your app with an authorization code
- Exchange — Your server exchanges the code for an access token
- API Call — Use the token to fetch user information
Endpoints
| Endpoint | URL | Method |
|---|---|---|
| Authorization | https://api.sloxly.com/v1/Oauth/authorization | GET |
| Token | https://api.sloxly.com/v1/Oauth/token | POST |
| User Info | https://api.sloxly.com/v1/Oauth/userinfo | GET |
Quick Start
Here's a minimal implementation in PHP:
PHP
// Step 1: Redirect to Sloxly $params = http_build_query([ 'client_id' => $your_client_id, 'redirect_uri' => 'https://yoursite.com/callback', ]); header("Location: https://api.sloxly.com/v1/Oauth/authorization?$params"); // Step 2: Exchange code for token (in callback.php) $response = curl_post("https://api.sloxly.com/v1/Oauth/token", [ 'client_id' => $client_id, 'client_secret' => $client_secret, 'code' => $_GET['code'], ]);