Skip to content

Commit

Permalink
Fix logout redirect by adding missing id_token_hint in url. (#1808)
Browse files Browse the repository at this point in the history
  • Loading branch information
atoncetti authored Dec 9, 2022
1 parent 9b031ac commit 61cb107
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/hygeia_web/controllers/auth_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule HygeiaWeb.AuthController do
nil ->
redirect(conn, to: "/")

_tokens ->
{tokens, "zitadel"} ->
end_session_endpoint =
case :oidcc.get_openid_provider_info("zitadel") do
{:ok, %{end_session_endpoint: end_session_endpoint}} -> end_session_endpoint
Expand All @@ -31,7 +31,14 @@ defmodule HygeiaWeb.AuthController do
query
|> Kernel.||("")
|> URI.decode_query()
|> Map.put("post_logout_redirect_uri", Routes.home_index_url(conn, :index))
|> Map.put(
"post_logout_redirect_uri",
conn |> Routes.home_index_url(:index) |> String.trim_trailing("/")
)
|> Map.put(
"id_token_hint",
tokens |> Map.fetch!(:id) |> Map.fetch!(:token)
)
|> URI.encode_query()

after_logout_url = URI.to_string(%{end_session_uri | query: query})
Expand Down

0 comments on commit 61cb107

Please sign in to comment.