package ez_api
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=e1d03d141ef977fbd4521256c91431f1
sha512=51b0cc4e6afb0cd5ab55c0c40964946b79e0c2cc903b5d08c594292eec723a25e25463175d704c02fe559e2af5d95973514c248a603ad28ec0230c35ad2d6492
doc/ez_api.session_client/EzSessionClient/Make/index.html
Module EzSessionClient.MakeSource
Parameters
module S : EzSession.TYPES.SessionArgSignature
See EzSession.TYPES.SessionArg.user_info.
See EzSession.TYPES.auth.
See EzSession.Make
type login_error = [ | EzSession.TYPES.login_error| EzSession.TYPES.connect_error| EzSession.TYPES.logout_error| `Too_many_login_attempts| `Session_expired
]Error that could be raised by login request.
val connect :
EzAPI.base_url ->
?token:string ->
(((S.user_id, S.user_info) EzSession.TYPES.auth option,
EzSession.TYPES.connect_error)
result ->
unit) ->
unitPerforms request to the server's authentication service if actual state is set to disconnected and calls callback on the response result. If state is set to connected or authenticated, then callback is called on actual connection/authentication status without performing request, unless token is specified.
val login :
?format:(string -> string) ->
EzAPI.base_url ->
?login:string ->
?password:string ->
?foreign:(string * string) ->
(((S.user_id, S.user_info) EzSession.TYPES.auth, login_error) result -> unit) ->
unitPerforms request to the server's login service. If actual state is set to disconnected, then firstly, it performs connect request. If connect request returns authentication information for different user (if token or cookies wasn't updated) or if other user is already autenticated, it performs logout for this user, and retry logining. If user is connected but not authenticated, it constructs challenge reply by using user's login and password or uses foreign user information to authenticate. Calls callback on authentification status.
val logout :
EzAPI.base_url ->
token:string ->
((bool, EzSession.TYPES.logout_error) result -> unit) ->
unitPerforms request to the server's logout service if actual state is set to authenticated. After this step, state is set to connected. Callback is called with Ok true if logout was successfully performed. If previous state wasn't set to authenticated, then callback is called with Ok false.
Tell the network layer that we think that the session has ended (a request probably returned an error status for missing auth). Since the state is kept internally, we have to do this first to trigger a full reconnection by `login`.
Returns authentication headers depending on S.token_kind for client requests. It doesn't include cookies because cookies are automatically added by browser.
Gets current authentication status, if exists.