PowAssent v0.1.0 PowAssent.Strategy.OAuth2 View Source

OAuth 2.0 strategy.

Usage

config :my_app, :pow_assent,
  providers: [
    example: [
      client_id: "REPLACE_WITH_CLIENT_ID",
      client_secret: "REPLACE_WITH_CLIENT_SECRET",
      strategy: PowAssent.Strategy.OAuth2,
      site: "https://auth.example.com",
      authorization_params: [scope: "user:read user:write"],
      user_url: "https://example.com/api/user"
    ]
  ]

Link to this section Summary

Link to this section Functions

Link to this function authorization_headers(config, token) View Source
authorization_headers(Keyword.t(), map()) :: [{binary(), binary()}]
Link to this function get(config, token, url, params \\ []) View Source
get(Keyword.t(), map(), binary(), map() | Keyword.t()) ::
  {:ok, map()} | {:error, term()}

Makes a HTTP get request to the API.

JSON responses will be decoded to maps.

Link to this function get_user(config, token, params \\ []) View Source
get_user(Keyword.t(), map(), map() | Keyword.t()) ::
  {:ok, map()} | {:error, term()}