PowAssent v0.2.2 PowAssent.Plug View Source
Plug helper methods.
If you wish to configure PowAssent through the Pow plug interface rather than
environment config, please add PowAssent config with :pow_assent
config:
plug Pow.Plug.Session,
repo: MyApp.Repo,
user: MyApp.User,
pow_assent: [
http_adapter: PowAssent.HTTPAdapter.Mint,
json_library: Poison,
user_identities_context: MyApp.UserIdentities
]
Link to this section Summary
Functions
Authenticates a user with provider and provider user params
Calls the authorize_url method for the provider strategy
Lists available providers for connection
Calls the callback method for the provider strategy
Creates an identity for a user with provider and provider user params
Create a user with the provider and provider user params
Deletes the associated user identity for the current user and provider
Lists associated providers for the user
Link to this section Functions
authenticate(Plug.Conn.t(), binary(), map()) :: {:ok, Plug.Conn.t()} | {:error, Plug.Conn.t()}
Authenticates a user with provider and provider user params.
If successful, a new session will be created.
authorize_url(Plug.Conn.t(), binary(), binary()) :: {:ok, binary(), Plug.Conn.t()} | {:error.any(), Plug.Conn.t()}
Calls the authorize_url method for the provider strategy.
A generated authorization URL will be returned. If :state
is returned from
the provider, it’ll be added to the connection as private key
:pow_assent_state
.
available_providers(Plug.Conn.t() | PowAssent.Config.t()) :: [atom()]
Lists available providers for connection.
callback(Plug.Conn.t(), binary(), map(), binary()) :: {:ok, map(), Plug.Conn.t()} | {:error, any(), Plug.Conn.t()}
Calls the callback method for the provider strategy.
Returns the user params fetched from the provider.
:state
will be added to the provider config if :pow_assent_state
is
present as a private key in the connection.
create_identity(Plug.Conn.t(), binary(), map()) :: {:ok, map(), Plug.Conn.t()} | {:error, {:bound_to_different_user, map()} | map(), Plug.Conn.t()}
Creates an identity for a user with provider and provider user params.
If successful, a new session will be created.
create_user(Plug.Conn.t(), binary(), map(), map() | nil) :: {:ok, map(), Plug.Conn.t()} | {:error, {:bound_to_different_user | :invalid_user_id_field, map()} | map(), Plug.Conn.t()}
Create a user with the provider and provider user params.
If successful, a new session will be created.
delete_identity(Plug.Conn.t(), binary()) :: {:ok, map(), Plug.Conn.t()} | {:error, {:no_password, map()}, Plug.Conn.t()}
Deletes the associated user identity for the current user and provider.
providers_for_current_user(Plug.Conn.t()) :: [atom()]
Lists associated providers for the user.