# `Assent.Strategy.OAuth.Base`
[🔗](https://github.com/pow-auth/assent/blob/v0.4.0/lib/assent/strategies/oauth/base.ex#L1)

OAuth 1.0a strategy base.

## Usage

    defmodule MyApp.MyOAuthStrategy do
      use Assent.Strategy.OAuth.Base

      @impl true
      def default_config(_config) do
        [
          base_url: "https://api.example.com",
          authorize_url: "/authorization/new",
          access_token_url: "/authorization/access_token",
          request_token_url: "/authorization/request_token",
          user_url: "/authorization.json",
          authorization_params: [scope: "default"]
        ]
      end

      @impl true
      def normalize(_config, user) do
        {:ok,
          # Conformed to https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.5.1
          %{
            "sub"   => user["id"],
            "name"  => user["name"],
            "email" => user["email"]
          # },
          # # Provider specific data not part of the standard claims spec
          # %{
          #  "https://example.com/bio" => user["bio"]
          }
        }
      end
    end

# `default_config`

```elixir
@callback default_config(Keyword.t()) :: Keyword.t()
```

Returns the default configuration for the OAuth 1.0a strategy.

# `fetch_user`

```elixir
@callback fetch_user(Keyword.t(), map()) :: {:ok, map()} | {:error, term()}
```

Fetches user data from the provider using an OAuth access token.

# `normalize`

```elixir
@callback normalize(Keyword.t(), map()) ::
  {:ok, map()} | {:ok, map(), map()} | {:error, term()}
```

Normalizes provider user data into standard claims and optional extra data.

# `authorize_url`

```elixir
@spec authorize_url(Keyword.t(), module()) :: Assent.Strategy.OAuth.on_authorize_url()
```

# `callback`

```elixir
@spec callback(Keyword.t(), map(), module()) :: Assent.Strategy.OAuth.on_callback()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
