bro_login (
{
login: "",
password: "",
max_age : seconds
},
handler
);
|
bro_login
function sends an HTTP authentication request to ahttpd. The reply is passed to the given handler in the form of an object (JSON).
If authenticated normally the result.session.session_cookie
and result.session.session_token
are present in the reply. The cookie is set automatically for 1 year if the were no max_age
argument in the request, or for the specified number of seconds otherwise. However, the token should explicitly be passed to bro
and bro_logout
.
In the case of an error the reply contains result.error
with the error code and the message.
bro ( { }, handler ); |
The main function bro
sends HTTP request to the special ahttpd module ui/bro/ajax.scm
which translates it to the corresponding woo request. The reply is passed to the given handler. The request should contain session_token
obtained as a result of authentication. The request and reply structures are the same as in woo but are encoded in JSON instead of Scheme. Authenticate with bro_login
above to get the example.
In the case of successful request the reply contains result.woo
— the backend answer translated to JSON.
In the case of an error the reply contains result.error
with the error code and the message.
bro_logout ( {,
keepcookie : true | false
},
handler
);
|
bro_logout
function sends the logout HTTP request to ahttpd in order to terminate the session. The reply is passed to the given handler in the form of an object (JSON). Same as with bro
the request should contain session_token
obtained as a result of authentication. Authenticate with bro_login
above to get the example.
In the case of successful request the reply contains the empty result.session
object. The cookie is removed automatically if no special keepcookie
flag was specified in the request.
In the case of an error the reply contains result.error
with the error code and the message.