pow-auth / assent

Multi-provider framework in Elixir
https://powauth.com
MIT License
391 stars 45 forks source link

`defoverride` for definitions from `Assent.Strategy` when `use`ing `Assent.Strategy.OAuth2.Base` #155

Open paulbalomiri opened 2 months ago

paulbalomiri commented 2 months ago

I'm implementing a provider, which needs an aditional body parameter when calling the token endpoint. in order to override &Assent.Strategy.callback/2, i think that the additional defoverridable Helpers (or defoverridable callback: 2) is needed, otherwhise the implementation in my custom module is ignored.

** Should this overridable definition not be included in the __using/2 definition of Assent.Strategy.OAuth2.Base?

The use definition defines these behavoiurs:

https://github.com/pow-auth/assent/blob/4457d3eb40cac19428ae45b2f00a884e93389a8b/lib/assent/strategies/oauth2/base.ex#L44-L45

The only defoverridable in the Assent.Strategy.OAuth2.Base.__using__/1 Macro is this one:

https://github.com/pow-auth/assent/blob/4457d3eb40cac19428ae45b2f00a884e93389a8b/lib/assent/strategies/oauth2/base.ex#L58

In order to override the callback/2 in my implementation module i need to do this:

defmodule CanteAuth.Assent.Strategy.Anaf do
  use Assent.Strategy.OAuth2.Base
 #Shouldn't this be in Assent.Strategy.OAuth2.Base.__using__/1?
  defoverridable Helpers
 ...
  @impl Helpers
  def callback(config, params) do

Is the macro Assent.Strategy.OAuth2.Base.__using__/1 really missing the line

defoverridable Helpers

or am I missing something obvious, for overriding functions imported from Assent.Strategy?

Thank you for this wonderful library! ❤️