身份驗證

Rememberizer 提供幾個認證端點來管理用戶帳戶和會話。本文檔概述了可用的認證 API。

註冊

範例請求

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

recaptcha_response 替換為實際的 reCAPTCHA 回應。

登入

範例請求

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

recaptcha_response 替換為實際的 reCAPTCHA 回應。

電子郵件驗證

範例請求

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

YOUR_JWT_TOKEN 替換為您的實際 JWT 令牌,並使用發送到您電子郵件的驗證碼。

令牌管理

示例請求

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

此端點使用 cookies 進行身份驗證。刷新令牌應作為 cookie 發送。

登出

範例請求

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

此端點將清除身份驗證 cookie。

const logout = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-logout/', {
    method: 'POST',
    credentials: 'include' // 這會在請求中包含 cookie
  });
  
  if (response.status === 204) {
    console.log("登出成功!");
  } else {
    console.error("登出失敗!");
  }
};

logout();

此端點使用 cookie 進行身份驗證。請確保您的應用程序在請求中包含憑證。

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("登出成功!")
    else:
        print("登出失敗!")

logout()

此端點將清除身份驗證 cookie。

{% endtabs %

Last updated