Library
Module
Module type
Parameter
Class
Class type
OAuth 2.0 authentication.
val authorize :
?state:string ->
?force_reapprove:bool ->
?disable_signup:bool ->
id:string ->
[ `Token of Uri.t | `Code of Uri.t option ] ->
Uri.t
authorize client_id response
starts the OAuth 2.0 authorization flow. This isn't an API call—it's the web page that lets the user sign in to Dropbox and authorize your app. The client_id
is the app's key, found in the App Console. After the user authorizes your app, they will be sent to your redirect URI. The type of response varies based on the response
:
`Token redirect_uri
(also called "implicit grant") returns the bearer token by redirecting the user to redirect_uri
after the authorization has completed. Extract the token using token_of_uri
. This is useful for pure client-side apps, such as mobile apps or JavaScript-based apps.`Code u
if u = Some redirect_uri
, returns a code via by redirecting the user to redirect_uri
(extract the code using code_of_uri
) or, if u = None
, presents the code to use user (on screen) who will be invited to copy it in your app. The code should then be converted into a bearer token using OAuth2.token
. This is recommended for apps that are running on a server.Note that the URI for `Token
and `Code
must be registered in the App Console; even 'localhost' must be listed if it is used for testing.
The authorization code, which can be used to attain a bearer token by calling token
.
val code_of_uri : Uri.t -> (code * string) option
code_of_uri u
return the code and state from the redirect URI u
after a `Code
authorization.
val token_of_uri : Uri.t -> (token * string) option
token_of_uri u
parse the URI coming from a `Token
flow and extract the token and state.
token code id secret
acquire a token once the user has authorized the app. Only applies to apps using the authorization `Code
flow.
code
is the code acquired by directing users to OAuth2.authorize ~response_type:`Code
.
id
this should be the app's key (found in the App Console).
secret
this parameter should be present and should be the app's secret.