---
title: "OAuth 2.0 | Tajo"
description: "안전한 서드파티 연동을 위한 OAuth 2.0 인증"
url: https://tajo.io/kr/docs/authentication/oauth/
markdown: https://tajo.io/kr/docs/authentication/oauth.md
lang: ko-KR
author: "Set Noa"
author_url: https://tajo.io/kr/set-noa/
robots: noindex
---

Tajo 사전 이용 신청

이름과 회사 이메일 주소를 입력하세요. Tajo 이용 신청을 확인할 수 있는 링크를 이메일로 보내드립니다.

# OAuth 2.0

[Set Noa](https://tajo.io/kr/set-noa/)

OAuth 2.0은 서드파티 애플리케이션이 사용자를 대신해 Brevo에 접근할 때 사용하는, 토큰 기반의 안전한 인증 방식입니다.

## OAuth 흐름 개요

1. **인가 요청**: 사용자를 Brevo로 리디렉션합니다
2. **사용자 인가**: 사용자가 권한을 승인합니다
3. **인가 코드**: Brevo가 코드와 함께 리디렉션합니다
4. **액세스 토큰 교환**: 코드를 토큰으로 교환합니다
5. **API 접근**: 액세스 토큰으로 요청을 보냅니다

## 인가 엔드포인트

```
https://app.brevo.com/oauth/authorize?
  response_type=code&
  client_id=YOUR_CLIENT_ID&
  redirect_uri=YOUR_REDIRECT_URI&
  scope=email%20contacts&
  state=random_string
```

## 토큰 교환

```bash
curl -X POST "https://api.brevo.com/v3/oauth/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code&code=AUTH_CODE&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&redirect_uri=YOUR_REDIRECT_URI"
```

## 액세스 토큰 사용

```javascript
const response = await fetch('https://api.brevo.com/v3/account', {
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Accept': 'application/json'
  }
});
```

## 스코프

- `email`: 트랜잭션 이메일 발송
- `contacts`: 연락처 및 리스트 관리
- `campaigns`: 캠페인 생성 및 발송
- `sms`: SMS 메시지 발송
- `webhooks`: 웹훅 관리

## 토큰 갱신

```javascript
const refreshToken = async () => {
  const response = await fetch('https://api.brevo.com/v3/oauth/token', {
    method: 'POST',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    body: new URLSearchParams({
      grant_type: 'refresh_token',
      refresh_token: 'YOUR_REFRESH_TOKEN',
      client_id: 'YOUR_CLIENT_ID',
      client_secret: 'YOUR_CLIENT_SECRET'
    })
  });
  return response.json();
};
```
