Skip to content

Allow redirect_uri, client_id, client_secret to be set through a fn with Plug.Conn as param#71

Open
mwingert wants to merge 1 commit intoerlef:mainfrom
fiasco-gmbh:feature/set-redirect_uri-with-fn-arity-1
Open

Allow redirect_uri, client_id, client_secret to be set through a fn with Plug.Conn as param#71
mwingert wants to merge 1 commit intoerlef:mainfrom
fiasco-gmbh:feature/set-redirect_uri-with-fn-arity-1

Conversation

@mwingert
Copy link

@mwingert mwingert commented Feb 5, 2026

For use cases where the redirect_uri needs to be set dynamically depending on the current Plug.Conn.
For example when the redirect_uri needs to contain the tenant as subdomain.

  plug Oidcc.Plug.AuthorizationCallback,
    provider: SampleApp.GoogleOpenIdConfigurationProvider,
    redirect_uri: &__MODULE__.get_callback_uri/1

  def get_callback_uri(%Plug.Conn{} = conn) do
    tenant = conn.assigns.tenant
    "https://#{tenant}.localhost:4000/oidcc/callback"
  end

Also client_id and client_secret would support being set that way.

…ith Plug.Conn as param

For use cases where the redirect_uri needs to be set dynamically depending on the current Plug.Conn.
For example when the redirect_uri needs to contain the tenant as subdomain.
```Elixir
    plug Oidcc.Plug.AuthorizationCallback,
      provider: SampleApp.GoogleOpenIdConfigurationProvider,
      redirect_uri: &__MODULE__.get_callback_uri/1

  def get_callback_uri(%Plug.Conn{} = conn) do
    tenant = conn.assigns.tenant
    "https://#{tenant}.localhost:4000/oidcc/callback"
  end

```
@mwingert mwingert changed the title Allow redirect_uri, client_id, client_secret to be set through a with Plug.Conn as param Allow redirect_uri, client_id, client_secret to be set through a fn with Plug.Conn as param Feb 10, 2026
@maennchen
Copy link
Member

I'm a bit backed up with work right now. I'll come back to this in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants