dwyl / elixir-auth-microsoft

🪟 Authenticate with your Microsoft Account in any Elixir App!
GNU General Public License v2.0
36 stars 5 forks source link

feature/support taking callback_uri from custom configuration #39

Closed robdembitel closed 8 months ago

robdembitel commented 1 year ago

Hello, would it be possible to also make it possible to set the callback path via the configuration file?

https://github.com/dwyl/elixir-auth-microsoft/blob/1637cb4afeac20ecd8c09b968b19ab80cc64f708/lib/elixir_auth_microsoft.ex#L164

I would suggest to align it with the other environment variables, like here: https://github.com/dwyl/elixir-auth-microsoft/blob/1637cb4afeac20ecd8c09b968b19ab80cc64f708/lib/elixir_auth_microsoft.ex#L156

so that set it also via the config file like e.g. this:

config :elixir_auth_microsoft,
  client_id: "",
  client_secret: "",
  post_logout_redirect_uri: "http://localhost:4000/auth/microsoft/logout",
  callback_uri: "http://localhost:4000/auth/microsoft/custom-callback-uri",

So this would be cool:

  defp get_callback_path do
    System.get_env("MICROSOFT_CALLBACK_PATH") || Application.get_env(:elixir_auth_microsoft, :callback_uri) || @default_callback_path
  end

Cheers!

LuchoTurtle commented 8 months ago

Sure thing! I'll open a micro-PR to get this working and publish it in the next version :)

LuchoTurtle commented 8 months ago

Feature added and it's part of the v1.3.0 release of the package, which is already published. https://hex.pm/packages/elixir_auth_microsoft

Thanks!