Skip to content

fix: OAuth2 웹 로그인 CORS 에러 해결 (303 리다이렉트 → 200 + redirectUrl) - #353

Merged
kmando01 merged 1 commit into
developfrom
KM/fix/oauth2-web-cors-redirect
Jun 17, 2026
Merged

fix: OAuth2 웹 로그인 CORS 에러 해결 (303 리다이렉트 → 200 + redirectUrl)#353
kmando01 merged 1 commit into
developfrom
KM/fix/oauth2-web-cors-redirect

Conversation

@kmando01

@kmando01 kmando01 commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

개요

브라우저에서 POST /api/v2/auth/login을 XHR/fetch로 호출했을 때 CORS 에러가 발생했다.
근본 원인은 Fetch 스펙의 크로스 오리진 리다이렉트 시 Origin: null 교체 동작이다.
auth.econovation.kr에 CORS 헤더를 추가해도 오리진이 null로 바뀌어 영원히 실패하는 구조였다.

303 리다이렉트 대신 200 + { "redirectUrl": "..." }을 반환하고, FE가 window.location.href로 브라우저 레벨 이동을 수행하도록 변경한다.


왜 에러가 났는가

┌─────────────────────────────────────────────────────────────────┐
│  기존 흐름 (BROKEN)                                              │
└─────────────────────────────────────────────────────────────────┘

① FE (auth-econovation-fe.vercel.app)
   └─ XHR/fetch → POST api.eeos.econovation.kr/api/v2/auth/login
                   Origin: https://auth-econovation-fe.vercel.app  ✅

② BE → 303 SEE OTHER
        Location: https://auth.econovation.kr?state=...

③ 브라우저가 자동으로 리다이렉트를 따라감
   └─ GET https://auth.econovation.kr?state=...
        Origin: null  ← ⚠️ Fetch 스펙: 크로스 오리진 리다이렉트 시 null로 교체

④ auth.econovation.kr
   Access-Control-Allow-Origin: https://auth-econovation-fe.vercel.app
   → "null" 과 불일치 → CORS 에러 ❌

   ※ auth.econovation.kr에 CORS 헤더를 아무리 추가해도 해결 불가

왜 이 방법으로 해결되는가

┌─────────────────────────────────────────────────────────────────┐
│  변경 후 흐름 (FIXED)                                            │
└─────────────────────────────────────────────────────────────────┘

① FE (auth-econovation-fe.vercel.app)
   └─ XHR/fetch → POST api.eeos.econovation.kr/api/v2/auth/login
                   Origin: https://auth-econovation-fe.vercel.app  ✅

② BE → 200 OK  (리다이렉트 없음)
        Set-Cookie: eeos_access_token=...  (domain=.econovation.kr)
        Set-Cookie: eeos_refresh_token=...
        Body: { "redirectUrl": "https://auth.econovation.kr?state=..." }

③ FE가 직접 브라우저 이동
   └─ window.location.href = "https://auth.econovation.kr?state=..."
      ↳ 브라우저 레벨 네비게이션 → CORS 검사 자체가 없음 ✅

④ auth.econovation.kr 도달
   └─ .econovation.kr 공유 쿠키 자동 포함 ✅

영향 범위

프론트엔드: POST /api/v2/auth/login 응답 처리 로직 변경 필수.

  • 기존: 서버 리다이렉트를 그대로 따라감
  • 변경 후: 응답 JSON의 redirectUrl을 읽어 window.location.href = redirectUrl 수행
  • 로그인 실패 시: 응답 body에 "error": "invalid_credentials" 키가 함께 포함됨

WEB/APP 공통 적용: WEB(쿠키 방식)과 APP(PKCE authorization code) 모두 동일하게 200 + redirectUrl 반환으로 변경됨.


배포 전 필수 확인

  • FE 팀이 POST /api/v2/auth/login 응답 처리를 window.location.href = redirectUrl 방식으로 변경했는지 확인
  • COOKIE_TOKEN_DOMAIN=.econovation.kr 설정 여부 확인 (WEB 타입 쿠키가 auth.econovation.kr에서 읽혀야 하므로)
  • BE 배포 후 FE 배포 순서 준수 (순서 반대 시 기존 303 처리 코드가 잘못된 응답을 처리하게 됨)

Summary by CodeRabbit

릴리스 노트

  • Refactor

    • OAuth2 로그인 응답 형식이 리다이렉트 기반에서 JSON 기반으로 변경되었습니다. 클라이언트는 응답 본문의 redirectUrl을 받아 직접 처리하면 됩니다.
  • Bug Fixes

    • 로그인 및 에러 응답이 구조화된 JSON 형식으로 개선되어 에러 정보를 보다 명확하게 전달합니다.
  • Documentation

    • API 문서가 새로운 응답 형식 및 처리 흐름을 반영하도록 업데이트되었습니다.

브라우저 XHR/fetch가 크로스 오리진 3xx 리다이렉트를 따라갈 때 Origin 헤더가
null로 교체되는 Fetch 스펙 때문에 auth.econovation.kr에 CORS 헤더를 추가해도
브라우저가 허용하지 않는 문제가 있었다.

POST /api/v2/auth/login에서 303 SEE_OTHER 대신 200 OK와 함께
{ "redirectUrl": "..." }를 반환하도록 변경한다.
FE는 응답 받은 후 window.location.href = redirectUrl로 브라우저 레벨
네비게이션을 수행해야 한다. 브라우저 레벨 이동은 CORS 적용 대상이 아니다.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

OAuth2 로그인 엔드포인트(/login)의 응답 방식이 HTTP 303 리다이렉트(Location 헤더)에서 HTTP 200 OK + JSON 바디(redirectUrl 키) 반환으로 전환됐다. OAuth2Api 인터페이스 계약, OAuth2Controller 구현, 관련 단위 테스트가 모두 새 방식에 맞게 갱신됐다.

Changes

OAuth2 로그인 응답 방식 리다이렉트 → JSON 전환

Layer / File(s) Summary
API 인터페이스 계약 변경
eeos/src/main/java/com/blackcompany/eeos/auth/presentation/docs/OAuth2Api.java
@ApiResponse의 응답 코드 및 설명이 303 리다이렉트 기반에서 200 OK + redirectUrl JSON 반환 방식으로 갱신됐고, login 메서드 반환 타입이 ResponseEntity<Void>에서 ResponseEntity<Map<String, String>>으로 변경됐다.
OAuth2Controller 응답 로직 전환
eeos/src/main/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2Controller.java
검증 실패 시 400 빈 응답 대신 {"error":"invalid_client"} JSON을 반환한다. handleWebLogin, handleAppLogin, redirectToLoginPageWithError 모두 ResponseEntity<Void> 대신 ResponseEntity<Map<String,String>>을 반환하며, Location 헤더 대신 redirectUrl 키에 목적지 URL을 담아 200 OK로 응답한다.
컨트롤러 테스트 검증 방식 전환
eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java
WEB/APP 로그인 성공 테스트가 303 + Location 헤더 검증에서 200 OK + 응답 바디 redirectUrl 검증으로 전환됐다. WEB 테스트는 SET_COOKIE 헤더도 추가로 검증하며, APP 테스트는 redirectUrlcodestate 포함 여부를 확인한다.

Sequence Diagram(s)

sequenceDiagram
  participant Client as 클라이언트
  participant OAuth2Controller as OAuth2Controller
  participant CookieService as CookieService

  rect rgba(255, 100, 100, 0.5)
    note over Client,CookieService: 이전 방식 (303 SEE_OTHER)
    Client->>OAuth2Controller: GET /login (client_id, redirect_uri, state)
    OAuth2Controller->>CookieService: 쿠키 설정 (WEB)
    OAuth2Controller-->>Client: 303 SEE_OTHER<br/>Location: redirect_uri?state=...
  end

  rect rgba(100, 180, 100, 0.5)
    note over Client,CookieService: 변경 후 방식 (200 OK + JSON)
    Client->>OAuth2Controller: GET /login (client_id, redirect_uri, state)
    alt WEB 클라이언트
      OAuth2Controller->>CookieService: 쿠키 설정
      OAuth2Controller-->>Client: 200 OK {"redirectUrl": "redirect_uri?state=..."}
    else APP 클라이언트
      OAuth2Controller-->>Client: 200 OK {"redirectUrl": "redirect_uri?code=...&state=..."}
    else 인증 실패
      OAuth2Controller-->>Client: 200 OK {"redirectUrl": "loginPageUrl?error=invalid_credentials", "error": "invalid_credentials"}
    end
    Client->>Client: redirectUrl로 직접 이동
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

bug

Suggested reviewers

  • Daae-Kim
  • rlajm1203

Poem

🐇 토끼가 뛰어가며 노래해요~
예전엔 303으로 폴짝 뛰었지만,
이제는 200 OK와 JSON 선물 🎁
redirectUrl 키에 담아 쏙 건네줘요.
클라이언트야, 직접 찾아가렴! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 주요 변경사항을 명확하게 설명합니다. 303 리다이렉트에서 200 + redirectUrl 방식으로의 변경과 이를 통한 CORS 에러 해결이라는 핵심 목표가 잘 드러나있습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch KM/fix/oauth2-web-cors-redirect

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kmando01

Copy link
Copy Markdown
Collaborator Author

FE 팀 필수 변경사항

POST /api/v2/auth/login 응답 처리 방식이 바뀌었습니다.

변경 전

// 서버가 303 리다이렉트를 내려주면 브라우저가 자동으로 따라감
await fetch('/api/v2/auth/login', {
  method: 'POST',
  credentials: 'include',
  body: new URLSearchParams({ client_id, redirect_uri, state, email, password }),
})
// 이후 처리 없음 - 브라우저가 알아서 이동

변경 후

const res = await fetch('/api/v2/auth/login', {
  method: 'POST',
  credentials: 'include',
  body: new URLSearchParams({ client_id, redirect_uri, state, email, password }),
})

const { redirectUrl, error } = await res.json()

if (error === 'invalid_credentials') {
  // 로그인 실패 - 에러 메시지 표시
  // redirectUrl에는 loginPage?...&error=invalid_credentials 가 담겨 있음
  showError('이메일 또는 비밀번호를 확인해주세요.')
  return
}

// 성공 - 브라우저 레벨로 직접 이동 (CORS 적용 안 됨)
window.location.href = redirectUrl

응답 스펙

상황 status body
로그인 성공 (WEB) 200 { "redirectUrl": "https://auth.econovation.kr?state=..." }
로그인 성공 (APP) 200 { "redirectUrl": "https://앱콜백?code=...&state=..." }
로그인 실패 200 { "redirectUrl": "loginPage?...&error=invalid_credentials", "error": "invalid_credentials" }
잘못된 client_id 400 { "error": "invalid_client" }

핵심 포인트

window.location.href로 이동해야 합니다. fetchaxiosredirectUrl을 다시 호출하면 안 됩니다.

@coderabbitai coderabbitai Bot added the bug Something isn't working label Jun 17, 2026
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Test Results

226 tests  ±0   224 ✅ ±0   9s ⏱️ -1s
 72 suites ±0     2 💤 ±0 
 72 files   ±0     0 ❌ ±0 

Results for commit 95f94df. ± Comparison against base commit 3ff1b37.

This pull request removes 2 and adds 2 tests. Note that renamed tests count towards both.
com.blackcompany.eeos.auth.presentation.controller.OAuth2ControllerTest$LoginOAuth2 ‑ APP 클라이언트 로그인 성공 시 authorization_code + 303 리다이렉트
com.blackcompany.eeos.auth.presentation.controller.OAuth2ControllerTest$LoginOAuth2 ‑ WEB 클라이언트 로그인 성공 시 쿠키 설정 + 303 리다이렉트
com.blackcompany.eeos.auth.presentation.controller.OAuth2ControllerTest$LoginOAuth2 ‑ APP 클라이언트 로그인 성공 시 200 + redirectUrl(authorization_code 포함) 반환
com.blackcompany.eeos.auth.presentation.controller.OAuth2ControllerTest$LoginOAuth2 ‑ WEB 클라이언트 로그인 성공 시 쿠키 설정 + 200 + redirectUrl 반환

♻️ This comment has been updated with latest results.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
eeos/src/main/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2Controller.java (1)

104-107: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

광범위한 예외 처리로 인해 서버 오류가 숨겨질 수 있음

catch(Exception e)NullPointerException, IllegalStateException 등 서버 측 버그까지 모두 invalid_credentials로 처리합니다. 실제 인증 실패와 서버 오류를 구분하지 못해 디버깅이 어려워집니다.

🛠️ 제안: 인증 관련 예외만 명시적으로 처리
-		} catch (Exception e) {
+		} catch (AuthenticationFailedException e) {
 			return redirectToLoginPageWithError(
 					clientId, redirectUri, state, codeChallenge, codeChallengeMethod);
 		}

또는 최소한 예외를 로깅하여 서버 오류 추적이 가능하도록 하세요:

 		} catch (Exception e) {
+			log.warn("Login failed for client {}: {}", clientId, e.getMessage());
 			return redirectToLoginPageWithError(
 					clientId, redirectUri, state, codeChallenge, codeChallengeMethod);
 		}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@eeos/src/main/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2Controller.java`
around lines 104 - 107, The catch block in OAuth2Controller is catching all
exceptions broadly and treating them uniformly as authentication failures, which
hides actual server-side errors like NullPointerException or
IllegalStateException. Replace the generic catch(Exception e) with either: (1)
specific exception handling for authentication-related exceptions only, or (2)
at minimum, add logging of the actual exception before calling
redirectToLoginPageWithError method so that server errors can be traced and
debugged. This will allow distinguishing between legitimate authentication
failures and unexpected server errors.
eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java (2)

101-113: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

invalid client 응답 body의 error 필드 검증 누락

컨트롤러가 Map.of("error", "invalid_client")를 반환하지만 테스트에서 body 내용을 검증하지 않습니다.

✅ 제안: error 필드 검증 추가
 			assertEquals(HttpStatus.BAD_REQUEST, result.getStatusCode());
+			assertNotNull(result.getBody());
+			assertEquals("invalid_client", result.getBody().get("error"));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java`
around lines 101 - 113, The test for the controller.login() method verifies only
the HTTP status code (BAD_REQUEST) but does not validate the response body. Add
an assertion to verify that the response body returned by result.getBody()
contains the "error" field with the value "invalid_client". This ensures the
controller is returning the expected error details in the response body when an
invalid client is provided.

116-195: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

인증 실패 시나리오 테스트 누락

redirectToLoginPageWithError가 호출되는 케이스(잘못된 credentials)에 대한 테스트가 없습니다. 새로운 JSON 응답 형식({ "redirectUrl": "...", "error": "invalid_credentials" })이 올바르게 반환되는지 검증이 필요합니다.

인증 실패 케이스 테스트를 생성해 드릴까요?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java`
around lines 116 - 195, The test class is missing test cases for authentication
failure scenarios where redirectToLoginPageWithError is called with invalid
credentials. Add new test methods (such as web_login_with_invalid_credentials
and app_login_with_invalid_credentials) that mock the oAuth2LoginService to
throw an exception or return failure for both WEB and APP client types. In these
tests, verify that the controller returns the new JSON response format
containing both a redirectUrl with error information and an error field with
value like "invalid_credentials", ensuring the HTTP status code appropriately
reflects the authentication failure.
eeos/src/main/java/com/blackcompany/eeos/auth/presentation/docs/OAuth2Api.java (1)

42-67: ⚠️ Potential issue | 🟠 Major

테스트 스크립트 갱신 필수: API 응답 코드 변경으로 인한 호환성 깨짐

API 응답 코드가 303에서 200으로 변경되었으나, 테스트 스크립트가 여전히 303 리다이렉트를 검증하고 있습니다. 다음 파일들을 갱신하지 않으면 CI/CD 테스트가 실패합니다:

  • scripts/api-test/test-auth-api.sh: 215, 227, 283, 331 라인 (assert_status 및 assert_redirect로 303 검증)
  • scripts/api-test/test-login-flow.sh: 108, 109, 127 라인 (LOGIN_STATUS = 303 비교)

테스트 스크립트를 새로운 200 응답 코드와 JSON 응답 본문(redirectUrl)에 맞게 갱신하세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@eeos/src/main/java/com/blackcompany/eeos/auth/presentation/docs/OAuth2Api.java`
around lines 42 - 67, The API response code for the OAuth2 login endpoint has
changed from HTTP 303 (redirect) to HTTP 200 (with JSON body containing
redirectUrl), but the test scripts are still validating the old 303 response
format. Update the test scripts test-auth-api.sh and test-login-flow.sh to
replace all assertions and status code comparisons that check for 303 redirect
responses with validations for HTTP 200 status codes. Additionally, modify these
test scripts to parse and validate the JSON response body (specifically the
redirectUrl field) instead of checking HTTP redirect headers or Location
headers, since the endpoint now returns the redirect URL in the response body
rather than using HTTP redirects.
🧹 Nitpick comments (2)
eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java (2)

192-194: ⚡ Quick win

동일하게 result.getBody() null 체크 누락

✅ 제안
 			assertEquals(HttpStatus.OK, result.getStatusCode());
+			assertNotNull(result.getBody());
 			assertTrue(result.getBody().get("redirectUrl").contains("code=auth-code-123"));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java`
around lines 192 - 194, The test assertions in OAuth2ControllerTest are missing
a null check for result.getBody() before accessing its contents with the get()
method. Add a null assertion or check to verify that result.getBody() is not
null before calling get("redirectUrl") on it in the subsequent assertions. This
ensures the test properly validates that the response body exists before
attempting to retrieve values from it.

154-157: ⚡ Quick win

result.getBody() null 체크 없이 접근

getBody()가 null을 반환할 경우 테스트가 NPE로 실패하여 실제 원인 파악이 어려워집니다.

✅ 제안: assertNotNull 추가
 			assertEquals(HttpStatus.OK, result.getStatusCode());
+			assertNotNull(result.getBody());
 			assertTrue(result.getBody().get("redirectUrl").contains("http://web/callback"));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java`
around lines 154 - 157, The test in OAuth2ControllerTest is accessing
result.getBody() multiple times without verifying it is not null first. If
getBody() returns null, the subsequent calls to get("redirectUrl") will throw a
NullPointerException instead of providing a clear test failure. Add an
assertNotNull check on result.getBody() before the lines that call
get("redirectUrl") to ensure the response body exists, providing better error
messages if the assertion fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In
`@eeos/src/main/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2Controller.java`:
- Around line 104-107: The catch block in OAuth2Controller is catching all
exceptions broadly and treating them uniformly as authentication failures, which
hides actual server-side errors like NullPointerException or
IllegalStateException. Replace the generic catch(Exception e) with either: (1)
specific exception handling for authentication-related exceptions only, or (2)
at minimum, add logging of the actual exception before calling
redirectToLoginPageWithError method so that server errors can be traced and
debugged. This will allow distinguishing between legitimate authentication
failures and unexpected server errors.

In
`@eeos/src/main/java/com/blackcompany/eeos/auth/presentation/docs/OAuth2Api.java`:
- Around line 42-67: The API response code for the OAuth2 login endpoint has
changed from HTTP 303 (redirect) to HTTP 200 (with JSON body containing
redirectUrl), but the test scripts are still validating the old 303 response
format. Update the test scripts test-auth-api.sh and test-login-flow.sh to
replace all assertions and status code comparisons that check for 303 redirect
responses with validations for HTTP 200 status codes. Additionally, modify these
test scripts to parse and validate the JSON response body (specifically the
redirectUrl field) instead of checking HTTP redirect headers or Location
headers, since the endpoint now returns the redirect URL in the response body
rather than using HTTP redirects.

In
`@eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java`:
- Around line 101-113: The test for the controller.login() method verifies only
the HTTP status code (BAD_REQUEST) but does not validate the response body. Add
an assertion to verify that the response body returned by result.getBody()
contains the "error" field with the value "invalid_client". This ensures the
controller is returning the expected error details in the response body when an
invalid client is provided.
- Around line 116-195: The test class is missing test cases for authentication
failure scenarios where redirectToLoginPageWithError is called with invalid
credentials. Add new test methods (such as web_login_with_invalid_credentials
and app_login_with_invalid_credentials) that mock the oAuth2LoginService to
throw an exception or return failure for both WEB and APP client types. In these
tests, verify that the controller returns the new JSON response format
containing both a redirectUrl with error information and an error field with
value like "invalid_credentials", ensuring the HTTP status code appropriately
reflects the authentication failure.

---

Nitpick comments:
In
`@eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java`:
- Around line 192-194: The test assertions in OAuth2ControllerTest are missing a
null check for result.getBody() before accessing its contents with the get()
method. Add a null assertion or check to verify that result.getBody() is not
null before calling get("redirectUrl") on it in the subsequent assertions. This
ensures the test properly validates that the response body exists before
attempting to retrieve values from it.
- Around line 154-157: The test in OAuth2ControllerTest is accessing
result.getBody() multiple times without verifying it is not null first. If
getBody() returns null, the subsequent calls to get("redirectUrl") will throw a
NullPointerException instead of providing a clear test failure. Add an
assertNotNull check on result.getBody() before the lines that call
get("redirectUrl") to ensure the response body exists, providing better error
messages if the assertion fails.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 18aa293d-9878-4106-89a2-3dcd7c37683a

📥 Commits

Reviewing files that changed from the base of the PR and between 3ff1b37 and 95f94df.

📒 Files selected for processing (3)
  • eeos/src/main/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2Controller.java
  • eeos/src/main/java/com/blackcompany/eeos/auth/presentation/docs/OAuth2Api.java
  • eeos/src/test/java/com/blackcompany/eeos/auth/presentation/controller/OAuth2ControllerTest.java

@kmando01
kmando01 merged commit 34fea3c into develop Jun 17, 2026
6 checks passed
@kmando01
kmando01 deleted the KM/fix/oauth2-web-cors-redirect branch June 17, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant