fix: sign id token using client secret
This commit is contained in:
parent
51d627efa4
commit
13461897b4
2 changed files with 5 additions and 1 deletions
|
@ -3,6 +3,10 @@ defmodule Comfycamp.Token do
|
||||||
|
|
||||||
def sign(claims) do
|
def sign(claims) do
|
||||||
secret = Application.fetch_env!(:comfycamp, :jwt_secret)
|
secret = Application.fetch_env!(:comfycamp, :jwt_secret)
|
||||||
|
sign(claims, secret)
|
||||||
|
end
|
||||||
|
|
||||||
|
def sign(claims, secret) do
|
||||||
signer = Joken.Signer.create("HS256", secret)
|
signer = Joken.Signer.create("HS256", secret)
|
||||||
Joken.Signer.sign(claims, signer)
|
Joken.Signer.sign(claims, signer)
|
||||||
end
|
end
|
||||||
|
|
|
@ -99,7 +99,7 @@ defmodule ComfycampWeb.OauthController do
|
||||||
{access_token, refresh_token} = Accounts.generate_oauth_tokens(code.user)
|
{access_token, refresh_token} = Accounts.generate_oauth_tokens(code.user)
|
||||||
|
|
||||||
id_token = IDToken.build_id_token(code.user, oidc_app.client_id)
|
id_token = IDToken.build_id_token(code.user, oidc_app.client_id)
|
||||||
{:ok, signed_id_token} = Token.sign(id_token)
|
{:ok, signed_id_token} = Token.sign(id_token, client_secret)
|
||||||
|
|
||||||
render(conn, :token,
|
render(conn, :token,
|
||||||
access_token: Base.url_encode64(access_token),
|
access_token: Base.url_encode64(access_token),
|
||||||
|
|
Loading…
Reference in a new issue