[개인 프로젝트] This class supports `client_secret_basic`, `client_secret_post`, and `none` by default. Client [kakao] is using [POST] instead.....

Turtle·2024년 8월 23일
0

👉문제 상황

카카오 소셜 로그인을 테스트하다가 제목과 같은 오류를 마주했다. 오류 메시지를 보면서 관련된 부분을 떠올려보다가 application.yml 부분이 생각나서 해당 코드를 확인했다. 아래는 application.yml 카카오 관련 설정 부분이다.

spring:
  thymeleaf:
    prefix: classpath:/templates/
    suffix: .html
  datasource:
    driver-class-name: org.h2.Driver
    url: jdbc:h2:tcp://localhost/~/db
    username: sa
    password:
  h2:
    console:
      enabled: true
  jpa:
    defer-datasource-initialization: true
    hibernate:
      ddl-auto: update
  security:
    oauth2:
      client:
        registration:
		
          # 중략 ...
          
          kakao:
            client-id: REST API키
            client-secret: Client Secret 코드
            scope:
              - account_email
              - profile_nickname
            redirect-uri: http://localhost:8080/login/oauth2/code/kakao
            authorization-grant-type: authorization_code
            client-name: Kakao
            # 문제가 됐던 부분
            client-authentication-method: POST
        provider:
          kakao:
            authorization-uri: https://kauth.kakao.com/oauth/authorize
            token-uri: https://kauth.kakao.com/oauth/token
            user-info-uri: https://kapi.kakao.com/v2/user/me
            user-name-attribute: id

Spring 공식문서를 조회했는데 관련 부분을 찾을 수 있었다.

Spring Security - Authenticate using client_secret_post

client-authentication-method의 값인 POSTclient_secret_post로 변경했더니 해결됐다.

0개의 댓글