Skip to content

Config redirect_uri has no effect. #12

Open
@aherranz

Description

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions