콘텐츠로 이동

인증 API

Rememberizer는 사용자 계정 및 세션 관리를 위한 여러 인증 엔드포인트를 제공합니다. 이 문서는 사용 가능한 인증 API를 설명합니다.

회원가입

POST /auth/signup/

예제 요청

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

recaptcha_response를 실제 reCAPTCHA 응답으로 교체하세요.

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

recaptcha_response를 실제 reCAPTCHA 응답으로 교체하세요.

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

recaptcha_response를 실제 reCAPTCHA 응답으로 교체하세요.

로그인

POST /auth/signin/

예제 요청

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

recaptcha_response를 실제 reCAPTCHA 응답으로 교체하세요.

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'
    })
  });

  // 응답에서 인증 쿠키 확인
  if (response.status === 204) {
    console.log("로그인 성공!");
  } else {
    console.error("로그인 실패!");
  }
};

signIn();

Info

recaptcha_response를 실제 reCAPTCHA 응답으로 교체하세요.

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("로그인 성공!")
    else:
        print("로그인 실패!")

sign_in()

Info

recaptcha_response를 실제 reCAPTCHA 응답으로 교체하세요.

이메일 인증

POST /auth/verify-email/

예제 요청

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

YOUR_JWT_TOKEN을 실제 JWT 토큰으로 교체하고, 이메일로 전송된 인증 코드를 사용하세요.

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("이메일 인증 성공!");
  } else {
    console.error("이메일 인증 실패!");
  }
};

verifyEmail();

Info

YOUR_JWT_TOKEN을 실제 JWT 토큰으로 교체하고, 이메일로 전송된 인증 코드를 사용하세요.

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("이메일 인증 성공!")
    else:
        print("이메일 인증 실패!")

verify_email()

Info

YOUR_JWT_TOKEN을 실제 JWT 토큰으로 교체하고, 이메일로 전송된 인증 코드를 사용하세요.

토큰 관리

POST /auth/custom-refresh/

예제 요청

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

Info

이 엔드포인트는 인증을 위해 쿠키를 사용합니다. 새로 고침 토큰은 쿠키로 전송되어야 합니다.

const refreshToken = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-refresh/', {
    method: 'POST',
    credentials: 'include' // 이 요청에 쿠키를 포함합니다
  });

  if (response.status === 204) {
    console.log("토큰이 성공적으로 새로 고쳐졌습니다!");
  } else {
    console.error("토큰 새로 고침에 실패했습니다!");
  }
};

refreshToken();

Info

이 엔드포인트는 인증을 위해 쿠키를 사용합니다. 애플리케이션이 요청에 자격 증명을 포함하는지 확인하세요.

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("토큰이 성공적으로 새로 고쳐졌습니다!")
    else:
        print("토큰 새로 고침에 실패했습니다!")

refresh_token()

Info

YOUR_REFRESH_TOKEN을 실제 새로 고침 토큰으로 교체하세요.

로그아웃

POST /auth/custom-logout/

예제 요청

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

Info

이 엔드포인트는 인증 쿠키를 지웁니다.

const logout = async () => {
  const response = await fetch('https://api.rememberizer.ai/api/v1/auth/custom-logout/', {
    method: 'POST',
    credentials: 'include' // 이 요청에 쿠키를 포함합니다.
  });

  if (response.status === 204) {
    console.log("로그아웃 성공!");
  } else {
    console.error("로그아웃 실패!");
  }
};

logout();

Info

이 엔드포인트는 인증을 위해 쿠키를 사용합니다. 애플리케이션이 요청에 자격 증명을 포함하는지 확인하세요.

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()

Info

이 엔드포인트는 인증 쿠키를 지웁니다.