Boruta core v0.1.0-rc.4 Boruta.Oauth.Validator View Source

Utility to validate the request according to the given parameters.

Link to this section Summary

Functions

Validates given OAuth parameters.

Link to this section Functions

Link to this function

validate(atom, params)

View Source
validate(action :: atom(), params :: map()) ::
  {:ok, params :: map()} | {:error, message :: String.t()}

Validates given OAuth parameters.

Examples

iex> validate(%{
  "grant_type" => "client_credentials",
  "client_id" => "client_id",
  "client_secret" => "client_secret"
})
{:ok, %{
  "grant_type" => "client_credentials",
  "client_id" => "client_id",
  "client_secret" => "client_secret"
}}

iex> validate(%{})
{:error, "Request is not a valid OAuth request. Need a grant_type or a response_type param."}