nyximos.log

[Spring Security] OAuth 구글 로그인 액세스 차단됨 400 오류: redirect_uri_mismatch 본문

ETC/피땀눈물

[Spring Security] OAuth 구글 로그인 액세스 차단됨 400 오류: redirect_uri_mismatch

nyximos 2022. 10. 3. 17:53

구글 로그인 버튼 누를시 redirect_uri_mismatch 에러가 발생한다.

 

API 및 서비스 → 사용자 인증정보 → OAuth 클라이언트 수정 → 승인된 리디렉션 URI

 

https://console.cloud.google.com/apis/

 

Google 클라우드 플랫폼

로그인 Google 클라우드 플랫폼으로 이동

accounts.google.com

 

 

아래 URI를 application.yml 파일의 redirect-uri에 입력해준다.

application.yml 

spring: 
  security:
    oauth2:
      client:
        registration:
          google: # /oauth2/authorization/google 이 주소를 동작하게 한다.
            client-id:
            client-secret: 
            redirect-uri: http://localhost:8086/login/oauth2/code/google
            scope:
              - email
              - profile