pow-auth / pow_assent

Multi-provider authentication for your Pow enabled app
https://powauth.com
MIT License
321 stars 50 forks source link

Add helper method to dynamically update provider config #166

Closed danschultzer closed 4 years ago

danschultzer commented 4 years ago

Resolves https://github.com/pow-auth/pow_assent/issues/117#issuecomment-571837184

Now the plug in the above issue can be reduced to just this:

defmodule MyAppWeb.PowAssent.UpdateProviderConfig do
  def init(opts), do: opts

  def call(conn, _opts) do
    updated_config = [authorization_params: [domain: conn.params["domain"]]]

    PowAssent.Plug.merge_provider_config(conn, :auth0, updated_config)
  end
end

The config will be deep merged. I'm not sure if this is the proper behavior instead of overriding the config values. It should probably also merge with default config in the provider.