fix: Google OAuth 스코프 누락 수정#23
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Google OAuth scope mismatch 대응
배경
GET /api/calendar/calendars요청에서RefreshErrorinvalid_scope: Bad Request기존 PR 설명처럼
calendar.readonly누락 문제가 아니라, 저장된 오래된 Google refresh token과 현재 앱이 사용하는 scope 집합이 어긋나면서 refresh 단계에서invalid_scope가 발생하는 문제였습니다.원인
build_credentials()에서 최신SCOPES전체를 refresh 요청에도 강제로 사용하고 있었음invalid_scope가 발생함변경 내용
backend/app/auth/service.pySCOPES를 강제하지 않도록build_credentials()수정backend/app/auth/dependencies.pyinvalid_scope발생 시 저장된 Google access/refresh token 제거401 google_reconnect_required응답으로 재연결 필요 상태를 명확히 반환backend/app/core/background_sync.pyfrontend/src/lib/api.tsgoogle_reconnect_required응답 시 Google 재연결 안내 토스트 표시테스트 보강
backend/tests/test_auth_dependencies.pyinvalid_scope분기 분리 검증backend/tests/services/test_background_sync.pyinvalid_scope발생 시 연결 해제 검증backend/tests/routers/test_auth.py/auth/callback신규 생성/기존 유저 업데이트/실패 분기/auth/me슬라이딩 세션 갱신 여부검증
./.venv/bin/ruff check ../.venv/bin/pytestpnpm lintpnpm testpnpm build참고:
pnpm build는 최초 1회 Google Fonts 네트워크 접근 제한으로 실패했고, 제한 해제 후 재실행하여 정상 통과했습니다.커밋
fb7072cfix: handle Google OAuth scope mismatch7338f5afix: show reconnect guidance for Google auth90743catest: expand auth router coverage