본인은 구글 클라우드를 사용하였다.
사용자 인증 정보 클라이언트를 생성 후
- access_type : offline (access token 새로고침)
- response_type : 반환할것
- redirect_uri : OAuth 클라이언트 ID를 생성할때 입력한 승인된 리디렉션 URI를 urlencode 한 것
- client_id : OAuth 클라이언트 ID를 생성하고 발급받은 클라이언트 ID
---
code를 복사해놓자
TalendAPI(Postman)에서 POST방식으로 https://oauth2.googleapis.com/token 해당 uri로
BODY에 code, client_id, client_secret, grant_type를 담아 다음과 같이
code=4/0AdLIrYclWNNOQQddLIrYcQduYcQdudLlWNIrYcQdudLIrYcQdulWNNOQ
&client_id=1065376047615-ca8n7aacvn2ve5jwn33ckfh1hsv99.apps.googleusercontent.com
&client_secret=GOBJKB-HOFEUMtPMsdil82ORlQLkTOgprYz
&redirect_uri=http://localhost:8080/authcode
&grant_type=authorization_code
요청을 보내면 된다.
참고 자료:
OAuth 2.0 토큰 가져오기 | Apigee | Google Cloud
Apigee API로 OAuth 액세스 토큰 및 승인 코드를 가져오는 방법과 Apigee OAuthV2 정책을 만들고 프록시 엔드포인트를 구성하는 방법을 알아봅니다.
cloud.google.com
https://soda-dev.tistory.com/60
[API] 구글 OAuth로 토큰(access token) 발급받기
구글 클라우드 플랫폼을 사용하여 연동한다. OAuth토큰 사용 포스트맨 (Postman) 사용 구글 클라우드 플랫폼 https://console.cloud.google.com/ Google Cloud Platform 하나의 계정으로 모든 Google 서비스를 Google Clou
soda-dev.tistory.com
https://ahn3330.tistory.com/166
[OAuth] HTTP 통신으로 구글 auth token 발급 및 구글 api 사용하기
OAuth 개념이 어려운데, 구글을 예시로 간단하게 말하면1. 사용자에게 권한 요청 및 동의를 받는다. 그러면 authrization code를 획득한다.2. authorization code를 가지고 구글에게 access token을 요청한다.3.
ahn3330.tistory.com
'Java > Spring Boot' 카테고리의 다른 글
[Thymeleaf] 문법 (0) | 2023.09.21 |
---|---|
Lombok | @Builder 동작 원리 (0) | 2023.09.21 |
[API 작성법] GET API 만드는 법 핵심 정리 (0) | 2023.09.14 |