UserSession
This model represents user session used for authentication purposes.
| Property | Type | Description | Information |
|---|---|---|---|
id | int | Identifier | Unique for single user session. |
user_id | int | Identifier of signed user. | Instance of User. |
client_ip | string | Client IP address | IP address of the client who created the session. |
user_agent | string or null | Client user agent | User agent of the client who created the session. |
access_token | string or null | JSON Web Token (JWT) | Access token for authentication. Provided only in freshly created session. |
refresh_token | string or null | JSON Web Token (JWT) | Refresh token for obtaining new access_token. Provided only in freshly created session. |
access_expiration_at | DateTime or null | Access expiration time | Also time of current access_token expiration. |
session_expiration_at | DateTime | Session expiration time | Also time of current refresh_token expiration. |
two_factor_verified | bool | Two factor verification status | Indicates if session is verified, or needs to be two factor verified |
Example:
{
"id": 8,
"user_id": 1,
"client_ip": "217.16.184.42",
"user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36",
"access_token": "eyJhbGciOiJzaGEyNTYiLCJ0eXAiOiJKV1QifQ.eyJpYXQiOjE1OTA5MzgxMzQsImp0aSI6MzcsInN1YiI6OTAsImV4cCI6MTU5MDk0MTczNCwidHlwIjoidSJ9.08a11c387ed0cb82bc2cd289a2fe3ac8663d7b01ca16952c8dd42598de8ce6b6",
"refresh_token": "eyJhbGciOiJzaGEyNTYiLCJ0eXAiOiJKV1QifQ.eyJpYXQiOjE1OTA5MzgxMzQsImp0aSI6MzgsInN1YiI6OTAsImV4cCI6MTU5MjE0NzczNCwidHlwIjoidSJ9.28a43fd4d578a94b7910e1418815472424a9269028c92d5b50732f4305a7f038",
"access_expiration_at": "2020-05-31T16:15:34+0000",
"session_expiration_at": "2020-06-14T15:15:34+0000",
"two_factor_verified": true
}
{
"id": 8,
"user_id": 1,
"client_ip": "217.16.184.42",
"user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36",
"access_token": null,
"refresh_token": null,
"access_expiration_at": null,
"session_expiration_at": "2020-06-14T15:15:34+0000",
"two_factor_verified": true
}
JSON Web Token (JWT)
JWT header structure
{
"alg": "sha256",
"typ": "JWT"
}
Payload data structure
{
"jti": 8,
"sub": 1,
"exp": 1564652472,
"iat": 1564648872
}
More about this standard you can find at https://jwt.io/.