Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config redirect_uri has no effect. #12

Open
aherranz opened this issue Nov 9, 2024 · 0 comments
Open

Config redirect_uri has no effect. #12

aherranz opened this issue Nov 9, 2024 · 0 comments

Comments

@aherranz
Copy link

aherranz commented Nov 9, 2024

Using ueberauth 0.10.8 and ueberauth_keycloak_strategy 0.4.0

I am trying to set up the strategy and to debug it in my dev environment. I have a redirect_uri in the configuration but the strategy does not honor it making redirecting to my server with redirect_uri param callback http://localhost:4000/oauth/callback.

In order to make it works I changes the strategy code Ueberauth.Strategy.Keycloak.handle_request!/1:

-     opts = [redirect_uri: redirect_uri, scope: scopes]
+    redirect_uri = :ueberauth |> Application.fetch_env!(Ueberauth.Strategy.Keycloak.OAuth) |> Keyword.get(:redirect_uri)
+    redirect_uri = redirect_uri || callback_url(conn)
+    opts = [redirect_uri: redirect_uri, scope: scopes]

I think that I found a potential mistake in function Ueberauth.Strategy.Keycloak.OAuth.authorize_url/2:

  def authorize_url(client, params) do
    client
    |> put_param("response_type", "code")
    |> put_param("redirect_uri", client().redirect_uri)

    OAuth2.Strategy.AuthCode.authorize_url(params)
  end

Shouldn't it be?

  def authorize_url(client, params) do
    client
    |> put_param("response_type", "code")
    |> put_param("redirect_uri", client().redirect_uri)
    |> OAuth2.Strategy.AuthCode.authorize_url(params)
  end
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

No branches or pull requests

1 participant