# Authentication
# Login
POST
/login
# Parameters
Parameter | Type | Required | Description |
---|---|---|---|
username | string | Yes | Username to be used for authentication |
password | string | Yes | Password to be used for authentication |
device_name | string | Yes | The name of the device used. |
# Example Request
curl --location --request POST 'https://yourwebsite.com/api/login' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "admin",
"password": "admin123",
"device_name": "iPhone 11 Pro"
}'
# Example Response
{
"token": "123asdfan23jnuhasnjkasdnuiwasnuinasdifnaisubdfas"
}
# Social Login
POST
/login/social
If user that is being authenticated does not exist his account will be automatically created (if registration is enabled) before token is being issued.
# Parameters
Parameter | Type | Required | Description |
---|---|---|---|
network | string | Yes | Network name according to the networks enabled by application configuration |
social_token | string | Yes | Token obtained from social network you want to authenticate with. |
device_name | string | Yes | The name of the device used. |
# Example Request
curl --location --request POST 'https://yourwebsite.com/api/login/social' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"network": "facebook",
"social_token": "asdf8ua9yadf7ya8d7fasdfyafd7as7fdas",
"device_name": "iPhone 11 Pro"
}'
# Example Response
{
"token": "123asdfan23jnuhasnjkasdnuiwasnuinasdifnaisubdfas"
}
# Logout
POST
/logout
Sending an request to logout endpoint with a valid API token will also invalidate that token.
# Example Request
curl --location --request POST 'https://yourwebsite.com/api/logout' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}'
# Example Response
Status: 200 OK
{
"success": true
}