WardrikOAuth. Request
(wardrik_oauth v0.1.0-rc.1)
Copy Markdown
Sends a flow's requests to an authorization server.
Each function takes Req options, plus :check, a function called on each URL first. URLs
must be https, or http on localhost.
Summary
Functions
Gets JSON from url.
Posts form to url as provider's client. Returns the status and the JSON body.
Posts body to url as JSON. Returns the status and the JSON body.
Puts value in form under key, unless it's nil or "".
Returns an OAuth error response as {:token_refused, error, description}.
Functions
Gets JSON from url.
@spec post_as(String.t(), WardrikOAuth.Provider.t(), map(), keyword()) :: {:ok, pos_integer(), map()} | {:error, term()}
Posts form to url as provider's client. Returns the status and the JSON body.
The client secret goes in the form, or in an HTTP Basic header if client_auth is :basic.
Posts body to url as JSON. Returns the status and the JSON body.
Puts value in form under key, unless it's nil or "".
@spec refusal(pos_integer(), map()) :: {:token_refused, String.t(), String.t() | nil}
Returns an OAuth error response as {:token_refused, error, description}.