---
title: "OAuth 2.0 | Tajo"
description: "Autenticazione OAuth 2.0 per integrazioni di terze parti sicure"
url: https://tajo.io/it/docs/authentication/oauth/
markdown: https://tajo.io/it/docs/authentication/oauth.md
lang: it-IT
author: "Set Noa"
author_url: https://tajo.io/it/set-noa/
robots: noindex
---

Richiedi l’accesso anticipato

Inserisci il tuo nome e indirizzo email aziendale. Ti invieremo un link per confermare la richiesta di accesso a Tajo.

# OAuth 2.0

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

OAuth 2.0 offre un’autenticazione sicura basata su token per le applicazioni di terze parti che accedono a Brevo per conto degli utenti.

## Panoramica del flusso OAuth

1. **Richiesta di autorizzazione**: reindirizza l’utente a Brevo
2. **Autorizzazione dell’utente**: l’utente concede i permessi
3. **Codice di autorizzazione**: Brevo reindirizza con il codice
4. **Scambio del token di accesso**: scambia il codice con i token
5. **Accesso all’API**: usa il token di accesso per le richieste

## Endpoint di autorizzazione

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

## Scambio del token

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

## Utilizzo del token di accesso

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

## Scope

- `email`: invio di e-mail transazionali
- `contacts`: gestione di contatti ed elenchi
- `campaigns`: creazione e invio di campagne
- `sms`: invio di messaggi SMS
- `webhooks`: gestione dei webhook

## Refresh del token

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