Auto-login¶
Flussonic Watcher allows its users to log in by a special URL (auto-login link), without entering a password. This is useful if you want to simplify access to Flussonic Watcher for your users or prevent the transfer of passwords to third parties.
The auto-login link is issued to an authorized client.
In order to generate a URL for auto-login, you will need to first request a token by using the link /vsaas/api/v2/auth/generate-autologin-token
. After that, the user can be authorized by sending the token via the POST method to /vsaas/autologin
.
Follow the steps:
1) First, you need to generate a token for the autologin of a particular user. To do this, make a POST request in the JSON format as follows:
curl --header "X-Vsaas-Api-Key: API_KEY" \
--header "Content-Type: application/json" \
--request POST --data '{"login": LOGIN, "valid_till": VALID_TILL, "lifetime": LIFETIME}' \
"http://watcher.com/vsaas/api/v2/auth/generate-autologin-token"
In the request, replace these placeholders with real values:
API_KEY
— the Watcher API key that can be found in the Watcher UI on the Settings page in API key. This key is sent in the HTTP headerX-Vsaas-Api-Key
.LOGIN
— the login (the same as the email) of the user to whom you want to give access. Line. Required.VALID_TILL
— the UTC time in seconds until this token is valid for autologin. Integer. Optional parameter.LIFETIME
— the duration of the session that will be open at the user's automatic logging in, in seconds. Integer. Optional parameter.
Watcher sends a response in the JSON format:
{
"autologin_token": "demo:1487258314:f8b1:b4bdaac58cbe94638e5b14a3728b8e6d633f3c6e",
"success": true
}
The autologin_token
field contains the token for the specified user.
2) The autologin_token
received in the previous step can be used in POST requests to Flussonic Watcher. For example:
<form action="http://watcher.com/vsaas/autologin" method="POST">
<input type="hidden" name="autologin_token" value="AUTOLOGIN_TOKEN" />
<input type="submit" />
</form>
At the click on the submit button, the user will be logged in automatically into the Flussonic Watcher web interface.