OAuth2 helpers for Dropbox.
Supports the modern short-lived access token + refresh token flow.
Authorization URL
Noizu.Dropbox.OAuth.authorize_url(
client_id: "APP_KEY",
redirect_uri: "https://example.com/oauth/callback",
token_access_type: "offline",
scope: "files.content.read files.content.write account_info.read"
)Exchange code
Noizu.Dropbox.OAuth.token(
code: code,
redirect_uri: redirect_uri,
client: client
)Refresh
Noizu.Dropbox.OAuth.refresh_token(refresh_token, client: client)
Summary
Functions
Build the user authorization URL.
Generate a PKCE code_verifier / S256 code_challenge pair.
Refresh and return an updated %Client{} with the new access token.
Refresh a short-lived access token.
Exchange an authorization code for tokens.
Types
Functions
@spec authorize_url(options()) :: String.t() | {:error, Noizu.Dropbox.Error.t()}
Build the user authorization URL.
Options
:client_id/ app key (required unless on client):redirect_uri:response_type— default"code":state:token_access_type—"offline"to receive a refresh token:scope— space-separated scopes:include_granted_scopes—"user"|"team":code_challenge/:code_challenge_method— PKCE:force_reapprove,:disable_signup,:require_role,:locale
Generate a PKCE code_verifier / S256 code_challenge pair.
@spec refresh_client(Noizu.Dropbox.Client.t()) :: {:ok, Noizu.Dropbox.Client.t(), map()} | {:error, Noizu.Dropbox.Error.t()}
Refresh and return an updated %Client{} with the new access token.
@spec refresh_token(String.t(), options()) :: {:ok, map()} | {:error, Noizu.Dropbox.Error.t()}
Refresh a short-lived access token.
@spec token(options()) :: {:ok, map()} | {:error, Noizu.Dropbox.Error.t()}
Exchange an authorization code for tokens.
Returns a map with string keys such as "access_token", "refresh_token",
"expires_in", "token_type", "account_id", "uid", "scope".