PowAssent v0.1.0 PowAssent.Strategy.OAuth.Base behaviour View Source

OAuth 1.0 strategy base.

Usage

defmodule MyApp.MyOAuthStratey do
  use PowAssent.Strategy.OAuth

  def default_config(_config) do
    [
      site: "https://api.example.com",
      authorize_url: "/authorization/new",
      token_url: "/authorization/token",
      user_url: "/authorization.json",
      authorization_params: [scope: "default"]
    ]
  end

  def normalize(_config, user) do
    {:ok, %{
      "uid"   => user["id"],
      "name"  => user["name"],
      "email" => user["email"]
    }}
  end
end

Link to this section Summary

Link to this section Functions

Link to this function authorize_url(config, conn, strategy) View Source
authorize_url(Keyword.t(), Plug.Conn.t(), module()) ::
  {:ok, %{conn: Plug.Conn.t(), url: binary()}}
  | {:error, %{conn: Plug.Conn.t(), error: any()}}
Link to this function callback(config, conn, params, strategy) View Source
callback(Keyword.t(), Plug.Conn.t(), map(), module()) ::
  {:ok, %{conn: Plug.Conn.t(), user: map()}}
  | {:error, %{conn: Plug.Conn.t(), error: any()}}

Link to this section Callbacks

Link to this callback default_config(arg0) View Source
default_config(Keyword.t()) :: Keyword.t()
Link to this callback get_user(arg0, map) View Source
get_user(Keyword.t(), map()) :: {:ok, map()} | {:error, any()}
Link to this callback normalize(arg0, map) View Source
normalize(Keyword.t(), map()) :: {:ok, map()} | {:error, any()}