Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
The Token
module manipulates authorization tokens. GitHub has two types of tokens: OAuth application tokens and "personal tokens".
Note: the OAuth Authorizations API has been deprecated by GitHub.
val of_code :
client_id:string ->
client_secret:string ->
code:string ->
unit ->
t option Lwt.t
of_code ~client_id ~client_secret ~code ()
is the t
granted by a code
from an OAuth web flow redirect.
val create :
?scopes:Github_t.scope list ->
?note:string ->
?note_url:string ->
?client_id:string ->
?client_secret:string ->
?fingerprint:string ->
?otp:string ->
user:string ->
pass:string ->
unit ->
Github_t.auth authorization Response.t Monad.t
create ?otp ~user ~pass ()
is a new authorization with the provided fields. When a user has enabled two-factor authentication, the return value will be a Two_factor
constructor with the one-time password delivery mode. Including a valid ?otp
will yield a Result
return value.
val get_all :
?otp:string ->
user:string ->
pass:string ->
unit ->
Github_t.auths authorization Response.t Monad.t
get_all ~user ~pass ()
are all of the authorizations that this user has made. See create
for an explanation of how two-factor authentication is handled.
val get :
?otp:string ->
user:string ->
pass:string ->
id:int64 ->
unit ->
Github_t.auth option authorization Response.t Monad.t
get ~user ~pass ~id ()
is the authorization with identifier id
. See create
for an explanation of how two-factor authentication is handled.
val delete :
?otp:string ->
user:string ->
pass:string ->
id:int64 ->
unit ->
unit authorization Response.t Monad.t
delete ~user ~pass ~id ()
is Result ()
after the authorization with identifier id
has been removed. See create
for an explanation of how two-factor authentication is handled.
val of_auth : Github_t.auth -> t
of_auth auth
is the OAuth application or personal token contained within auth
.
val of_string : string -> t
of_string token_string
is the abstract token value corresponding to the string token_string
.
val to_string : t -> string
to_string token
is the string serialization of token
.