Vai al contenuto

Authentication

Rememberizer provides several authentication endpoints to manage user accounts and sessions. This document outlines the available authentication APIs.

Sign Up

{% openapi src="/assets/images/f-7T1Jx6BU3fZ2U5LsImW1.webp" path="/auth/signup/" method="post" %} rememberizer_openapi.yml

Example Requests

{% tabs %}

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"
  }'

Info

Replace recaptcha_response with an actual reCAPTCHA response.

{% endtab %}

{% tab title="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();

Info

Replace recaptcha_response with an actual reCAPTCHA response.

{% endtab %}

{% tab title="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()

Info

Replace recaptcha_response with an actual reCAPTCHA response.

{% endtab %}

Sign In

{% openapi src="/assets/images/f-7T1Jx6BU3fZ2U5LsImW1.webp" path="/auth/signin/" method="post" %} rememberizer_openapi.yml

Example Requests

{% tabs %}

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"
  }'

Info

Replace recaptcha_response with an actual reCAPTCHA response.

{% endtab %}

{% tab title="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'
    })
  });

  // Check for auth cookies in response
  if (response.status === 204) {
    console.log("Login successful!");
  } else {
    console.error("Login failed!");
  }
};

signIn();

Info

Replace recaptcha_response with an actual reCAPTCHA response.

{% endtab %}

{% tab title="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("Login successful!")
    else:
        print("Login failed!")

sign_in()

Info

Replace recaptcha_response with an actual reCAPTCHA response.

{% endtab %}

Email Verification

{% openapi src="/assets/images/f-7T1Jx6BU3fZ2U5LsImW1.webp" path="/auth/verify-email/" method="post" %} rememberizer_openapi.yml

Example Requests

{% tabs %}

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"
  }'

Info

Replace YOUR_JWT_TOKEN with your actual JWT token and use the verification code sent to your email.

{% endtab %}

{% tab title="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("Email verification successful!");
  } else {
    console.error("Email verification failed!");
  }
};

verifyEmail();

Info

Replace YOUR_JWT_TOKEN with your actual JWT token and use the verification code sent to your email.

{% endtab %}

{% tab title="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("Email verification successful!")
    else:
        print("Email verification failed!")

verify_email()

Info

Replace YOUR_JWT_TOKEN with your actual JWT token and use the verification code sent to your email.

{% endtab %}

Token Management

{% openapi src="/assets/images/f-7T1Jx6BU3fZ2U5LsImW1.webp" path="/auth/custom-refresh/" method="post" %} rememberizer_openapi.yml

Example Requests

{% tabs %}

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

Info

This endpoint uses cookies for authentication. The refresh token should be sent as a cookie.

{% endtab %}

{% tab title="JavaScript" %}

const refreshToken = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-refresh/', {
    method: 'POST',
    credentials: 'include' // This includes cookies in the request
  });

  if (response.status === 204) {
    console.log("Token refreshed successfully!");
  } else {
    console.error("Token refresh failed!");
  }
};

refreshToken();

Info

This endpoint uses cookies for authentication. Make sure your application includes credentials in the request.

{% endtab %}

{% tab title="Python" %}

import requests

def refresh_token():
    cookies = {
        "refresh_token": "YOUR_REFRESH_TOKEN"
    }

    response = requests.post(
        "https://api.rememberizer.ai/api/v1/auth/custom-refresh/",
        cookies=cookies
    )

    if response.status_code == 204:
        print("Token refreshed successfully!")
    else:
        print("Token refresh failed!")

refresh_token()

Info

Replace YOUR_REFRESH_TOKEN with your actual refresh token.

{% endtab %}

Logout

{% openapi src="/assets/images/f-7T1Jx6BU3fZ2U5LsImW1.webp" path="/auth/custom-logout/" method="post" %} rememberizer_openapi.yml

Example Requests

{% tabs %}

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

Info

This endpoint will clear the authentication cookies.

{% endtab %}

{% tab title="JavaScript" %}

const logout = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-logout/', {
    method: 'POST',
    credentials: 'include' // This includes cookies in the request
  });

  if (response.status === 204) {
    console.log("Logout successful!");
  } else {
    console.error("Logout failed!");
  }
};

logout();

Info

This endpoint uses cookies for authentication. Make sure your application includes credentials in the request.

{% endtab %}

{% tab title="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("Logout successful!")
    else:
        print("Logout failed!")

logout()

Info

This endpoint will clear the authentication cookies.

{% endtab %}