Skip to content

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

Merged
maennchen merged 1 commit intoerlef:mainfrom
fiasco-gmbh:feature/set-redirect_uri-with-fn-arity-1
Apr 9, 2026
Merged

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

Conversation

@mwingert
Copy link
Copy Markdown

@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
Copy Markdown
Member

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

@maennchen maennchen merged commit 5e9111d into erlef:main Apr 9, 2026
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