# Authentification

Rememberizer fournit plusieurs points de terminaison d'authentification pour gérer les comptes utilisateurs et les sessions. Ce document décrit les APIs d'authentification disponibles.

## Inscription

{% openapi src="/files/k0wV9YEEppPnffcGeVUk" path="/auth/signup/" method="post" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de requêtes

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/signup/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "secure_password",
    "name": "John Doe",
    "captcha": "recaptcha_response"
  }'
```

{% hint style="info" %}
Remplacez `recaptcha_response` par une réponse reCAPTCHA réelle.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const signUp = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/signup/', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'user@example.com',
      password: 'secure_password',
      name: 'John Doe',
      captcha: 'recaptcha_response'
    })
  });
  
  const data = await response.json();
  console.log(data);
};

signUp();
```

{% hint style="info" %}
Remplacez `recaptcha_response` par une réponse reCAPTCHA réelle.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def sign_up():
    headers = {
        "Content-Type": "application/json"
    }
    
    payload = {
        "email": "user@example.com",
        "password": "secure_password",
        "name": "John Doe",
        "captcha": "recaptcha_response"
    }
    
    response = requests.post(
        "https://api.rememberizer.ai/api/v1/auth/signup/",
        headers=headers,
        data=json.dumps(payload)
    )
    
    data = response.json()
    print(data)

sign_up()
```

{% hint style="info" %}
Remplacez `recaptcha_response` par une réponse reCAPTCHA réelle.
{% endhint %}
{% endtab %}
{% endtabs %}

## Connexion

{% openapi src="/files/k0wV9YEEppPnffcGeVUk" path="/auth/signin/" method="post" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de requêtes

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/signin/ \
  -H "Content-Type: application/json" \
  -d '{
    "login": "user@example.com",
    "password": "secure_password",
    "captcha": "recaptcha_response"
  }'
```

{% hint style="info" %}
Remplacez `recaptcha_response` par une réponse reCAPTCHA réelle.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const signIn = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/signin/', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      login: 'user@example.com',
      password: 'secure_password',
      captcha: 'recaptcha_response'
    })
  });
  
  // Vérifiez les cookies d'authentification dans la réponse
  if (response.status === 204) {
    console.log("Connexion réussie !");
  } else {
    console.error("Échec de la connexion !");
  }
};

signIn();
```

{% hint style="info" %}
Remplacez `recaptcha_response` par une réponse reCAPTCHA réelle.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def sign_in():
    headers = {
        "Content-Type": "application/json"
    }
    
    payload = {
        "login": "user@example.com",
        "password": "secure_password",
        "captcha": "recaptcha_response"
    }
    
    response = requests.post(
        "https://api.rememberizer.ai/api/v1/auth/signin/",
        headers=headers,
        data=json.dumps(payload)
    )
    
    if response.status_code == 204:
        print("Connexion réussie !")
    else:
        print("Échec de la connexion !")

sign_in()
```

{% hint style="info" %}
Remplacez `recaptcha_response` par une réponse reCAPTCHA réelle.
{% endhint %}
{% endtab %}
{% endtabs %}

## Vérification de l'Email

{% openapi src="/files/k0wV9YEEppPnffcGeVUk" path="/auth/verify-email/" method="post" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de Requêtes

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/verify-email/ \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "verification_code": "123456"
  }'
```

{% hint style="info" %}
Remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et utilisez le code de vérification envoyé à votre email.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const verifyEmail = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/verify-email/', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      verification_code: '123456'
    })
  });
  
  if (response.status === 200) {
    console.log("Vérification de l'email réussie !");
  } else {
    console.error("Échec de la vérification de l'email !");
  }
};

verifyEmail();
```

{% hint style="info" %}
Remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et utilisez le code de vérification envoyé à votre email.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def verify_email():
    headers = {
        "Authorization": "Bearer YOUR_JWT_TOKEN",
        "Content-Type": "application/json"
    }
    
    payload = {
        "verification_code": "123456"
    }
    
    response = requests.post(
        "https://api.rememberizer.ai/api/v1/auth/verify-email/",
        headers=headers,
        data=json.dumps(payload)
    )
    
    if response.status_code == 200:
        print("Vérification de l'email réussie !")
    else:
        print("Échec de la vérification de l'email !")

verify_email()
```

{% hint style="info" %}
Remplacez `YOUR_JWT_TOKEN` par votre véritable jeton JWT et utilisez le code de vérification envoyé à votre email.
{% endhint %}
{% endtab %}
{% endtabs %}

## Gestion des jetons

{% openapi src="/files/k0wV9YEEppPnffcGeVUk" path="/auth/custom-refresh/" method="post" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de Requêtes

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/custom-refresh/ \
  -b "refresh_token=VOTRE_REFRESH_TOKEN"
```

{% hint style="info" %}
Ce point de terminaison utilise des cookies pour l'authentification. Le jeton de rafraîchissement doit être envoyé sous forme de cookie.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const refreshToken = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-refresh/', {
    method: 'POST',
    credentials: 'include' // Cela inclut les cookies dans la requête
  });
  
  if (response.status === 204) {
    console.log("Jeton rafraîchi avec succès !");
  } else {
    console.error("Échec du rafraîchissement du jeton !");
  }
};

refreshToken();
```

{% hint style="info" %}
Ce point de terminaison utilise des cookies pour l'authentification. Assurez-vous que votre application inclut des informations d'identification dans la requête.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests

def refresh_token():
    cookies = {
        "refresh_token": "VOTRE_REFRESH_TOKEN"
    }
    
    response = requests.post(
        "https://api.rememberizer.ai/api/v1/auth/custom-refresh/",
        cookies=cookies
    )
    
    if response.status_code == 204:
        print("Jeton rafraîchi avec succès !")
    else:
        print("Échec du rafraîchissement du jeton !")

refresh_token()
```

{% hint style="info" %}
Remplacez `VOTRE_REFRESH_TOKEN` par votre véritable jeton de rafraîchissement.
{% endhint %}
{% endtab %}
{% endtabs %}

## Déconnexion

{% openapi src="/files/k0wV9YEEppPnffcGeVUk" path="/auth/custom-logout/" method="post" %}
[rememberizer\_openapi.yml](https://3811618827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwduaTA5Sz3nf9aH5k1S6%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=9d0098e1-f392-4761-be64-ff6f2caad99e)
{% endopenapi %}

### Exemples de requêtes

```bash
curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/custom-logout/
```

{% hint style="info" %}
Ce point de terminaison effacera les cookies d'authentification.
{% endhint %}

```javascript
const logout = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-logout/', {
    method: 'POST',
    credentials: 'include' // Cela inclut les cookies dans la requête
  });
  
  if (response.status === 204) {
    console.log("Déconnexion réussie !");
  } else {
    console.error("Échec de la déconnexion !");
  }
};

logout();
```

{% hint style="info" %}
Ce point de terminaison utilise des cookies pour l'authentification. Assurez-vous que votre application inclut les informations d'identification dans la requête.
{% endhint %}

```python
import requests

def logout():
    session = requests.Session()
    
    response = session.post(
        "https://api.rememberizer.ai/api/v1/auth/custom-logout/"
    )
    
    if response.status_code == 204:
        print("Déconnexion réussie !")
    else:
        print("Échec de la déconnexion !")

logout()
```

{% hint style="info" %}
Ce point de terminaison effacera les cookies d'authentification.
{% endhint %}

{% endtabs %


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rememberizer.ai/fr/ressources-pour-les-developpeurs/api-docs/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
