Skip to content

Authentication related messages


Authenticate via email

Field name Type Required Description Default value
type string Y Value must be AuthEmail
email string Y Authentication email address
password string Y Authentication password
create boolean N If the user is not created yet, create new one false

Example request:

{
    "type": "AuthEmail",
    "email": "erhanbaris@gmail.com",
    "password": "erhan",
    "create": true
}


Authenticate via device id

Field name Type Required Description
type string Y Value must be AuthDeviceId
id string Y Authentication device id

Example request:

{
    "type": "AuthDeviceId",
    "id": "1234567890"
}


Authenticate via custom id

Field name Type Required Description
type string Y Value must be AuthCustomId
id string Y Authentication device id

Example request:

{
    "type": "AuthCustomId",
    "id": "ABV123"
}


Refreshing token

Regenerating token with new expire date.

Field name Type Required Description
type string Y Value must be RefreshToken
token string Y Valid Authentication token

Example request:

{
    "type": "RefreshToken",
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzA1Mjg3MTEsInVzZXIiOnsiaWQiOiJiMDhkN2I3OS0xNDA1LTQxZGMtODJhMS02YTg4MjU3OWM3MmEiLCJzZXNzaW9uIjoiM2IxMzdjYWUtZmY1OC00NjY5LTg1YjctOWEyM2NiOGRiYzAxIiwibmFtZSI6bnVsbCwiZW1haWwiOiJlcmhhbmJhcmlzQGdtYWlsLmNvbSJ9fQ.6tLnsjWPRCz0cW00j2nzV-SUk6GwrlYgxe9V_p5mhxU"
}


Restoring session

The user should be restore token after reconnecting to the system. If timeout exceeded, the session will be terminated and active game and player will be informed.

Field name Type Required Description
type string Y Value must be RestoreToken
token string Y Valid Authentication token

Example request:

{
    "type": "RestoreToken",
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzA1Mjg3MTEsInVzZXIiOnsiaWQiOiJiMDhkN2I3OS0xNDA1LTQxZGMtODJhMS02YTg4MjU3OWM3MmEiLCJzZXNzaW9uIjoiM2IxMzdjYWUtZmY1OC00NjY5LTg1YjctOWEyM2NiOGRiYzAxIiwibmFtZSI6bnVsbCwiZW1haWwiOiJlcmhhbmJhcmlzQGdtYWlsLmNvbSJ9fQ.6tLnsjWPRCz0cW00j2nzV-SUk6GwrlYgxe9V_p5mhxU"
}


Logout

Terminates the current session and active game and player will be informed.

Field name Type Required Description
type string Y Value must be Logout

Example request:

{
    "type": "Logout"
}

Field name Type Nullable Description
status boolean N Value should be true

Example response:

{
    "status": true
}

Field name Type Nullable Description
status boolean N Value should be false
error string N Error message

Example response:

{
    "status": false,
    "error": "User not logged in"
}


Authenticate response message

All authentication response message structure is the same.

Field name Type Nullable Description
status boolean N Value should be true
type string N Value should be Authenticated
token string N User's authentication token

Example response:

{
    "status": true,
    "type": "Authenticated",
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzI3NzE2NTQsInVzZXIiOnsiaWQiOiJiMDhkN2I3OS0xNDA1LTQxZGMtODJhMS02YTg4MjU3OWM3MmEiLCJzZXNzaW9uIjoiZWJiNWNkNzctM2M2Ni00NTQ2LTk2OGQtYTNjOGMwNTBiMjczIiwibmFtZSI6bnVsbCwiZW1haWwiOiJlcmhhbmJhcmlzQGdtYWlsLmNvbSIsInVzZXJfdHlwZSI6MX19.k2eM1xV4XnUx33f0pBVUD_lLgIcw0K1l2DOpJueG7g8"
}
Field name Type Nullable Description
status boolean N Value should be false
error string N Error message

Example response:

{
    "status": false,
    "error": "Email and/or password not valid"
}