Appearance
API Auth
Compatibility
- EE2, EE3, EE4, EE5, EE6, EE7
Installation
The Auth API comes natively with the Webservice module.
Methods
POST /index.php/webservice/auth — Authenticate
Authenticate a user and retrieve a session ID.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username | string | Required | Your username or email address |
password | string | Required | Your account password |
new_session | boolean | Optional | Force creation of a new session |
Headers
| Header | Value |
|---|---|
Content-Type | application/json |
Request Example
php
$client = new \GuzzleHttp\Client();
$request = new \GuzzleHttp\Psr7\Request(
'POST',
'https://your-domain.com/index.php/webservice/auth',
['Content-Type' => 'application/json'],
json_encode([
'data' => [
'username' => 'my-username',
'password' => 'your-password',
],
])
);
$response = $client->send($request, ['timeout' => 2]);💡 With
new_session: Add'new_session' => trueto thedatapayload to force a new session.
Response — 200 OK
json
{
"message": "successfully auth",
"success": true,
"data": [
{
"member_id": 4,
"session_id": "054b64e828b876b1192170211314a36f58fffb21"
}
]
}Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | true when authentication succeeded |
message | string | Human readable status message |
data[].member_id | integer | The authenticated member's ID |
data[].session_id | string | Session token to use in subsequent requests |
