Authentication Service
| Resource | Requires Authentication | Requires SignalR (Notifications) |
|---|---|---|
/api/v1/auth | Logout only | No |
POST /api/v1/auth/login
Authenticates a user and returns an access token using OAuth 2.0 Resource Owner Password Credentials Grant.
Request
- Content-Type:
application/x-www-form-urlencoded
| Property | Content | Description |
|---|---|---|
grant_type | password | Must be set to password. |
username | [username] | Username provided by user. |
password | [password] | Password provided by user. |
Response
HTTP 200 OK — A Login object.
Example
Request:
POST /localhost/alertws/api/v1/auth/login
Content-Type: application/x-www-form-urlencoded
grant_type=password&username=testuser&password=123
Response:
{
"access_token": "LdOq5Za8tX7NUEgUyT7M4GPixOIWbkLo3miXDdblbfBUtgX4g1kSBCXCIObDctjtpWiPk26Vg5EOwDUSLSc1z0E2-dElvnPH6ZES_9c4kRGN-oobnetd7bb6SXHvpYk2G9J_1kjZQiZjOg0XV5km-5eSr4_aYfE4ze1CMIlO_rSLkv2LioQb3Nhsmsc4jKk8igUqXMufo0A8Wg6LNdxjFeF_g99AU2zduAg212XOHReR4Lsb8Vd112A6yq4dQUC1X81Ex99SXzG0hpLY8j2aiSR7gRLmW3UwsXbbgevcM3kbMnvJO9cI4medJH1q_xsjUAdvoBhYztVRA1bWMAk-YSzeeUv5XTaIfYJ8jOhg3",
"token_type": "bearer",
"expires_in": 1209599,
"id": "1",
"name": "ALERT"
}
POST /api/v1/auth/logout
Logs out the current user and invalidates the session.
Request
Requires a valid Bearer token in the Authorization header.
Response
HTTP 200 OK
Example
Request:
POST /localhost/alertws/api/v1/auth/logout
Authorization: Bearer {access_token}
Response:
HTTP 200 OK