-
Notifications
You must be signed in to change notification settings - Fork 9
Managing the session and Authentication
For authenticating yourself, you need to put in the HTTP header of the request the Key Authorization
and in the value the string Token
, a space and the token obtained from TARALLO.
e.g. Authorization: Token yoLeCHmEhNNseN0BlG0s3A:ksfPYziGg7ebj0goT0Zc7pbmQEIYvZpRTIkwuscAM_k
Specifically, that's the default token for the development version. When you do a make up
, you get that token already configured.
If you want to add more tokens (e.g. in production):
- Open TARALLO
- Go to Options
- Type any description ("My awesome program that accesses the APIs")
- Press "Get token"
- Copy the token from the green confirmation message
Part of the token is hashed in the database, that's why it's replaced by ********** in the table, copy it from the green thing 'cause that's the only time you're going to see it un-hashed and in plain text.
Do a GET request to /v2/session
.
In case of session expired or user not authenticated the response will look like this:
{
"exception": "WEEEOpen\\Tarallo\\HTTP\\AuthenticationException",
"message": "Not authenticated or session expired"
}
If the session is valid the response will look like this:
{
"username": "John.Doe",
"cn": "John Doe",
"level": 0
}
Response codes:
200
- The user is authenticated (valid session)
401
- The user is not authenticated or session has expired