fix(oidc): use user data from temporary code, not from conn.assigns

This commit is contained in:
Ivan R. 2024-09-21 12:55:16 +05:00
parent 08f94ad16b
commit 3176d05afc
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
2 changed files with 3 additions and 3 deletions

View file

@ -70,7 +70,7 @@ defmodule Comfycamp.SSO do
query = query =
from c in OIDCCode, from c in OIDCCode,
preload: [:oidc_app], preload: [:oidc_app, :user],
where: c.value == ^value and c.inserted_at >= ^ten_minutes_ago where: c.value == ^value and c.inserted_at >= ^ten_minutes_ago
Repo.one!(query) Repo.one!(query)

View file

@ -96,9 +96,9 @@ defmodule ComfycampWeb.OauthController do
# Delete the code. # Delete the code.
SSO.delete_oidc_code(code) SSO.delete_oidc_code(code)
{access_token, refresh_token} = Accounts.generate_oauth_tokens(conn.assigns.current_user) {access_token, refresh_token} = Accounts.generate_oauth_tokens(code.user)
id_token = IDToken.build_id_token(conn.assigns.current_user, oidc_app.client_id) id_token = IDToken.build_id_token(code.user, oidc_app.client_id)
{:ok, signed_id_token, _claims} = Token.generate_and_sign(id_token) {:ok, signed_id_token, _claims} = Token.generate_and_sign(id_token)
render(conn, :token, render(conn, :token,