---
title: "OAuth 2.0 | Tajo"
description: "OAuth 2.0 authentication for secure third-party integrations"
url: https://tajo.io/docs/authentication/oauth/
markdown: https://tajo.io/docs/authentication/oauth.md
lang: en-US
author: "Set Noa"
author_url: https://tajo.io/set-noa/
---

# OAuth 2.0

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

OAuth 2.0 provides secure, token-based authentication for third-party applications accessing Brevo on behalf of users.

## OAuth Flow Overview

1. **Authorization Request**: Redirect user to Brevo
2. **User Authorization**: User grants permissions
3. **Authorization Code**: Brevo redirects with code
4. **Access Token Exchange**: Exchange code for tokens
5. **API Access**: Use access token for requests

## Authorization Endpoint

```
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
```

## Token Exchange

```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"
```

## Access Token Usage

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

## Scopes

- `email`: Send transactional emails
- `contacts`: Manage contacts and lists
- `campaigns`: Create and send campaigns
- `sms`: Send SMS messages
- `webhooks`: Manage webhooks

## Token Refresh

```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();
};
```
