package imap

  1. Overview
  2. Docs

IMAP Authenticators.

Used with the AUTHENTICATE command to perform SASL authentication. See Imap.authenticate.

type t = {
  1. name : string;
    (*

    The name of the authentication method.

    *)
  2. step : string -> [ `OK | `NEEDS_MORE ] * string;
    (*

    The authentication function. In order to perform SASL authentication, this function is called with each of the challenges from the server, in turn. The challenges are not encoded. For each challenge, it returns a pair (rc, s). s is the string that needs to be sent back to the server. rc is `OK if the mechanism does not need to be called again with more data from the server, and `NEEDS_MORE if it does. This does not mean that the server will not send more data (for example, in case of authentication error), just that the mechanism does not need more data. Conversely, if the server behaves as if authentication is done, but this function has returned `NEEDS_MORE, then something is amiss.

    *)
}
val plain : string -> string -> t

plain user pass authenticates with the PLAIN SASL mechanism with username user and password pass.

val xoauth2 : string -> string -> t

xoauth2 user token authenticates using the XOAUTH2 mehchanism with username user and access token token.