Xác thực

Rememberizer cung cấp một số điểm cuối xác thực để quản lý tài khoản người dùng và phiên làm việc. Tài liệu này phác thảo các API xác thực có sẵn.

Đăng Ký

Ví dụ Yêu cầu

curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/signup/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "secure_password",
    "name": "John Doe",
    "captcha": "recaptcha_response"
  }'

Thay thế recaptcha_response bằng một phản hồi reCAPTCHA thực tế.

Đăng Nhập

Ví dụ Yêu cầu

curl -X POST \
  https://api.rememberizer.ai/api/v1/auth/signin/ \
  -H "Content-Type: application/json" \
  -d '{
    "login": "[email protected]",
    "password": "secure_password",
    "captcha": "recaptcha_response"
  }'

Thay thế recaptcha_response bằng một phản hồi reCAPTCHA thực tế.

Xác minh Email

Ví dụ Yêu cầu

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

Thay thế YOUR_JWT_TOKEN bằng mã JWT thực tế của bạn và sử dụng mã xác minh được gửi đến email của bạn.

Quản lý Token

Ví dụ Yêu cầu

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

Điểm cuối này sử dụng cookie để xác thực. Mã thông báo làm mới nên được gửi dưới dạng cookie.

Đăng xuất

Ví dụ Yêu cầu

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

Điểm cuối này sẽ xóa các cookie xác thực.

const logout = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-logout/', {
    method: 'POST',
    credentials: 'include' // Điều này bao gồm các cookie trong yêu cầu
  });
  
  if (response.status === 204) {
    console.log("Đăng xuất thành công!");
  } else {
    console.error("Đăng xuất thất bại!");
  }
};

logout();

Điểm cuối này sử dụng cookie để xác thực. Đảm bảo ứng dụng của bạn bao gồm thông tin xác thực trong yêu cầu.

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("Đăng xuất thành công!")
    else:
        print("Đăng xuất thất bại!")

logout()

Điểm cuối này sẽ xóa các cookie xác thực.

{% endtabs %

Last updated