fix(oidc): use user data from temporary code, not from conn.assigns
This commit is contained in:
parent
08f94ad16b
commit
3176d05afc
2 changed files with 3 additions and 3 deletions
|
@ -70,7 +70,7 @@ defmodule Comfycamp.SSO do
|
|||
|
||||
query =
|
||||
from c in OIDCCode,
|
||||
preload: [:oidc_app],
|
||||
preload: [:oidc_app, :user],
|
||||
where: c.value == ^value and c.inserted_at >= ^ten_minutes_ago
|
||||
|
||||
Repo.one!(query)
|
||||
|
|
|
@ -96,9 +96,9 @@ defmodule ComfycampWeb.OauthController do
|
|||
# Delete the 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)
|
||||
|
||||
render(conn, :token,
|
||||
|
|
Loading…
Reference in a new issue