BARON-SSO 로그인 code_verifier 추가 server.js
All checks were successful
ITAM Code Check / build-and-config-check (push) Successful in 12s
ITAM Docker Build Check / docker-build-check (push) Successful in 29s

This commit is contained in:
2026-06-30 17:00:30 +09:00
parent 1970802b8c
commit 05b09ccc5a

View File

@@ -362,11 +362,12 @@ const resolveRedirects = async (redirectTo, cookies, depth = 0) => {
throw new Error('Could not resolve authorization redirect'); throw new Error('Could not resolve authorization redirect');
}; };
const exchangeAuthorizationCode = async (code, discovery) => { const exchangeAuthorizationCode = async (code, discovery, codeVerifier) => {
const body = new URLSearchParams({ const body = new URLSearchParams({
grant_type: 'authorization_code', grant_type: 'authorization_code',
code, code,
redirect_uri: REDIRECT_URI, redirect_uri: REDIRECT_URI,
code_verifier: codeVerifier,
client_id: CLIENT_ID, client_id: CLIENT_ID,
client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
client_assertion: createClientAssertion(discovery.token_endpoint) client_assertion: createClientAssertion(discovery.token_endpoint)
@@ -428,7 +429,7 @@ const runHeadlessSsoLogin = async ({ loginId, password }) => {
throw new Error('Authorization code not found after redirect resolution'); throw new Error('Authorization code not found after redirect resolution');
} }
const tokenResponse = await exchangeAuthorizationCode(resolution.code, discovery); const tokenResponse = await exchangeAuthorizationCode(resolution.code, discovery, authState.codeVerifier);
const idTokenPayload = decodeJwtPayload(tokenResponse.id_token); const idTokenPayload = decodeJwtPayload(tokenResponse.id_token);
return { return {
@@ -501,7 +502,11 @@ const pollHeadlessPhoneLogin = async (pendingContext) => {
throw new Error('Authorization code not found after phone redirect resolution'); throw new Error('Authorization code not found after phone redirect resolution');
} }
const tokenResponse = await exchangeAuthorizationCode(resolution.code, pendingContext.discovery); const tokenResponse = await exchangeAuthorizationCode(
resolution.code,
pendingContext.discovery,
pendingContext.authState.codeVerifier
);
const idTokenPayload = decodeJwtPayload(tokenResponse.id_token); const idTokenPayload = decodeJwtPayload(tokenResponse.id_token);
return { return {