OAuth Status Management OAuth 상태 관리

Manage user authentication states and enable secure OAuth token transfers with blockchain-powered access control. 사용자 인증 상태를 관리하고 블록체인 기반 접근 제어로 안전한 OAuth 토큰 이전을 지원합니다.

🔄 Overview: WebXcom + DeOAuth Integration 🔄 개요: WebXcom + DeOAuth 통합

DeOAuth is integrated with the WebXcom platform to provide users with access control and authorization tokens based on WEB3.0 philosophy. Users have full control over their DeOAuth authorization tokens, including the ability to transfer access rights to others. DeOAuth는 WEB3.0 철학에 기반한 접근 제어와 인가 토큰을 제공하기 위해 WebXcom 플랫폼과 통합되어 있습니다. 사용자는 자신의 DeOAuth 인가 토큰을 완전히 제어할 수 있으며, 다른 사람에게 접근 권한을 이전할 수도 있습니다.

ℹ️ What Makes This Special? ℹ️ 무엇이 특별한가요?

Unlike traditional OAuth systems, DeOAuth enables users to transfer their OAuth permissions to other users, creating a marketplace for access rights. This is powered by blockchain technology on the XOTN Network. 기존 OAuth 시스템과 달리, DeOAuth는 사용자가 OAuth 권한을 다른 사용자에게 이전할 수 있게 합니다. 이를 통해 접근 권한 마켓플레이스가 형성됩니다. XOTN 네트워크의 블록체인 기술로 구동됩니다.

Key Concepts 핵심 개념

  • User-Controlled Tokens: Users own and manage their authentication tokens 사용자 제어 토큰: 사용자가 자신의 인증 토큰을 소유하고 관리합니다
  • Transferable Access Rights: OAuth permissions can be sold or transferred to others 이전 가능한 접근 권한: OAuth 권한을 판매하거나 다른 사람에게 이전할 수 있습니다
  • Blockchain Verification: All transfers are recorded on the XOTN Network 블록체인 검증: 모든 이전 내역이 XOTN 네트워크에 기록됩니다
  • Logout Verification: WebXcom verifies complete logout state before allowing transfers 로그아웃 검증: WebXcom이 이전 허용 전 완전한 로그아웃 상태를 확인합니다

🔐 Why Logout State Matters 🔐 로그아웃 상태가 중요한 이유

DeOAuth emphasizes the logout process more than the login process. When a user wants to transfer their OAuth information to someone else, the WebXcom platform must ensure the OAuth status is in a complete "Logged Out" state. DeOAuth는 로그인 과정보다 로그아웃 과정을 더 강조합니다. 사용자가 OAuth 정보를 다른 사람에게 전송하려면, WebXcom 플랫폼이 OAuth 상태가 완전한 "로그아웃" 상태인지 확인해야 합니다.

⚠️ Security Requirement ⚠️ 보안 요구사항

Before OAuth information can be listed as a product on the WebXcom marketplace, the current user must be completely logged out. This prevents unauthorized access during the transfer period. OAuth 정보를 WebXcom 마켓플레이스에 상품으로 등록하기 전에, 현재 사용자는 완전히 로그아웃되어야 합니다. 이전 기간 동안의 무단 접근을 방지합니다.

Transfer Flow 이전 흐름

flowchart LR Active[🟢 User Active Session] Logout[🔴 User Logs Out] Verify[✅ WebXcom Verifies
Logout State] List[📦 OAuth Listed
on Marketplace] Transfer[🔄 Transfer to
New Owner] NewLogin[🟢 New Owner
Logs In] Active --> Logout Logout --> Verify Verify --> List List --> Transfer Transfer --> NewLogin style Active fill:#1c1c1c,stroke:#a3e635,color:#efefef style Logout fill:#1c1c1c,stroke:#ef4444,color:#efefef style Verify fill:#1c1c1c,stroke:#f97316,color:#efefef style List fill:#1c1c1c,stroke:#888888,color:#efefef style Transfer fill:#1c1c1c,stroke:#888888,color:#efefef style NewLogin fill:#1c1c1c,stroke:#a3e635,color:#efefef

API 1 Change Login Status 로그인 상태 변경

Update the user's OAuth status to "Logged In" on the WebXcom platform. This API notifies WebXcom that the user is currently accessing your application. 사용자의 OAuth 상태를 WebXcom 플랫폼에서 '로그인'으로 업데이트합니다. 이 API는 사용자가 현재 애플리케이션에 접근 중임을 WebXcom에 알립니다.

POST /v1/oauth/status/login

Request Headers 요청 헤더

Header Type Required Description
Authorization string Required Bearer {access_token}
Content-Type string Required application/json

Request Body 요청 본문

Parameter Type Required Description
user_id string Required Unique user ID from initial content registration 초기 콘텐츠 등록 시 발급된 고유 사용자 ID
client_id string Required Your application's client ID 애플리케이션의 클라이언트 ID
const response = await fetch('http://127.0.0.1:3000/v1/oauth/status/login', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    user_id: 'user-uuid-12345',
    client_id: 'your-client-id'
  })
});

const data = await response.json();
console.log('Login status updated:', data);
curl -X POST http://127.0.0.1:3000/v1/oauth/status/login \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "user-uuid-12345",
    "client_id": "your-client-id"
  }'
import requests

response = requests.post(
    'http://127.0.0.1:3000/v1/oauth/status/login',
    headers={
        'Authorization': f'Bearer {access_token}',
        'Content-Type': 'application/json'
    },
    json={
        'user_id': 'user-uuid-12345',
        'client_id': 'your-client-id'
    }
)

data = response.json()
print('Login status updated:', data)

Response

{
  "success": true,
  "message": "Login status updated successfully",
  "user_id": "user-uuid-12345",
  "status": "logged_in",
  "timestamp": "2026-02-05T13:45:30Z"
}
sequenceDiagram participant User as 👤 User participant App as 💻 Your Application participant WebXcom as 🌐 WebXcom Platform participant Deck as 🎴 DECK Display User->>App: Logs in to application App->>App: Authenticate user Note over App: User receives
access token App->>WebXcom: POST /status/login
(access_token, user_id) WebXcom->>WebXcom: Validate token WebXcom->>WebXcom: Update OAuth status
to "Logged In" WebXcom-->>App: Success response WebXcom->>Deck: Update DECK display Deck->>Deck: Show green "Active" badge App-->>User: Login complete

ℹ️ What is DECK? ℹ️ DECK이란?

DECK is a card-designed OAuth information display on the WebXcom platform. Users can view their OAuth status, manage permissions, and initiate transfers through the DECK interface. DECK은 WebXcom 플랫폼의 카드 형태 OAuth 정보 표시 인터페이스입니다. 사용자는 DECK을 통해 OAuth 상태를 확인하고, 권한을 관리하며, 이전을 시작할 수 있습니다.

API 2 Change Logout Status 로그아웃 상태 변경

Update the user's OAuth status to "Logged Out" on the WebXcom platform. This is critical for enabling OAuth token transfers, as WebXcom requires verification of complete logout state before allowing marketplace listings. 사용자의 OAuth 상태를 WebXcom 플랫폼에서 '로그아웃'으로 업데이트합니다. 이는 OAuth 토큰 전송을 활성화하기 위해 매우 중요하며, WebXcom은 마켓플레이스 등록을 허용하기 전에 완전한 로그아웃 상태를 확인합니다.

POST /v1/oauth/status/logout

Request Headers 요청 헤더

Header Type Required Description
Authorization string Required Bearer {access_token}
Content-Type string Required application/json

Request Body 요청 본문

Parameter Type Required Description
user_id string Required Unique user ID from initial content registration 초기 콘텐츠 등록 시 발급된 고유 사용자 ID
client_id string Required Your application's client ID 애플리케이션의 클라이언트 ID
const response = await fetch('http://127.0.0.1:3000/v1/oauth/status/logout', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    user_id: 'user-uuid-12345',
    client_id: 'your-client-id'
  })
});

const data = await response.json();
console.log('Logout status updated:', data);

if (data.success) {
  localStorage.removeItem('access_token');
  window.location.href = '/';
}
curl -X POST http://127.0.0.1:3000/v1/oauth/status/logout \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "user-uuid-12345",
    "client_id": "your-client-id"
  }'
import requests

response = requests.post(
    'http://127.0.0.1:3000/v1/oauth/status/logout',
    headers={
        'Authorization': f'Bearer {access_token}',
        'Content-Type': 'application/json'
    },
    json={
        'user_id': 'user-uuid-12345',
        'client_id': 'your-client-id'
    }
)

data = response.json()
print('Logout status updated:', data)

if data['success']:
    # Clear local session
    session.clear()
    # Redirect to homepage
    return redirect('/')

Response

{
  "success": true,
  "message": "Logout status updated successfully",
  "user_id": "user-uuid-12345",
  "status": "logged_out",
  "transfer_enabled": true,
  "timestamp": "2026-02-05T14:30:15Z"
}
sequenceDiagram participant User as 👤 User participant App as 💻 Your Application participant WebXcom as 🌐 WebXcom Platform participant Marketplace as 🛒 Marketplace participant Deck as 🎴 DECK Display User->>App: Clicks logout button App->>App: Clear local session App->>WebXcom: POST /status/logout
(access_token, user_id) WebXcom->>WebXcom: Validate token WebXcom->>WebXcom: Update OAuth status
to "Logged Out" WebXcom->>WebXcom: Enable transfer flag WebXcom-->>App: Success response WebXcom->>Deck: Update DECK display Deck->>Deck: Show red "Inactive" badge WebXcom->>Marketplace: OAuth now transferable Marketplace->>Marketplace: Enable "List for Sale" App-->>User: Logout complete

⚠️ Critical: Implement Logout in Your Application ⚠️ 중요: 애플리케이션에 로그아웃 기능 구현

Your application MUST provide a logout feature for users. Without this, users cannot transfer their OAuth permissions on the WebXcom marketplace. The platform will reject any listing where the OAuth status is not "Logged Out". 애플리케이션은 사용자를 위한 로그아웃 기능을 반드시 제공해야 합니다. 이 기능이 없으면 사용자는 WebXcom 마켓플레이스에서 OAuth 권한을 전송할 수 없습니다. 플랫폼은 OAuth 상태가 '로그아웃'이 아닌 경우 모든 등록을 거부합니다.

🔒 Security Best Practices 🔒 보안 모범 사례

1. Always Validate Access Tokens 1. 항상 액세스 토큰 검증

Before calling status update APIs, verify that the access token is valid and belongs to the user making the request. 상태 업데이트 API를 호출하기 전에, 액세스 토큰이 유효하고 요청하는 사용자의 것인지 확인하세요.

async function validateToken(accessToken) {
  try {
    const response = await fetch('http://127.0.0.1:3000/v1/oauth/validate', {
      headers: { 'Authorization': `Bearer ${accessToken}` }
    });
    return response.ok;
  } catch (error) {
    console.error('Token validation failed:', error);
    return false;
  }
}

2. Sync Status Updates 2. 상태 업데이트 동기화

Call the login status API immediately after successful user authentication, and the logout status API immediately before destroying the user's session. 사용자 인증 성공 직후 로그인 상태 API를 호출하고, 사용자 세션을 삭제하기 직전에 로그아웃 상태 API를 호출하세요.

  • On Login: Authenticate → Issue session → Update status → Redirect to dashboard 로그인 시: 인증 → 세션 발급 → 상태 업데이트 → 대시보드 이동
  • On Logout: Update status → Clear session → Redirect to homepage 로그아웃 시: 상태 업데이트 → 세션 삭제 → 홈페이지 이동

3. Handle Errors Gracefully 3. 오류 우아하게 처리

If the status update API fails, log the error but don't block the user's login/logout flow. Implement retry logic with exponential backoff. 상태 업데이트 API가 실패하면 오류를 기록하되 사용자의 로그인/로그아웃 흐름을 차단하지 마세요. 지수 백오프를 사용한 재시도 로직을 구현하세요.

async function updateStatusWithRetry(endpoint, data, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      const response = await fetch(endpoint, {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${accessToken}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(data)
      });
      
      if (response.ok) return await response.json();
      
    } catch (error) {
      console.error(`Attempt ${i + 1} failed:`, error);
      if (i < maxRetries - 1) {
        await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
      }
    }
  }
  throw new Error('Status update failed after retries');
}

4. Monitor Transfer Eligibility 4. 이전 자격 모니터링

Before listing OAuth tokens on the marketplace, verify the user's logout status with WebXcom. Display clear warnings if transfer is not yet enabled. 마켓플레이스에 OAuth 토큰을 등록하기 전에, WebXcom으로 사용자의 로그아웃 상태를 확인하세요. 전송이 아직 활성화되지 않은 경우 명확한 경고를 표시하세요.

ℹ️ Transfer Eligibility Check ℹ️ 이전 자격 확인

Use the /v1/oauth/status/check endpoint to verify if a user's OAuth token is eligible for transfer. This returns the current status and transfer_enabled flag. /v1/oauth/status/check 엔드포인트를 사용하여 사용자의 OAuth 토큰이 전송 가능한지 확인하세요. 현재 상태와 transfer_enabled 플래그를 반환합니다.

🎯 Complete Implementation Example 🎯 완전한 구현 예시

Here's a complete Express.js implementation showing login, logout, and status synchronization: 로그인, 로그아웃, 상태 동기화를 보여주는 완전한 Express.js 구현 예시입니다:

const express = require('express');
const axios = require('axios');

const app = express();
const WEBXCOM_API = 'http://127.0.0.1:3000';

app.post('/login', async (req, res) => {
  try {
    const { email, password } = req.body;
    
    const authResponse = await axios.post(`${WEBXCOM_API}/v1/dev-user/login_devuser`, {
      email,
      password
    });
    
    const { token, uuid } = authResponse.data;
    
    req.session.userId = uuid;
    req.session.accessToken = token;
    
    await axios.post(`${WEBXCOM_API}/v1/oauth/status/login`, {
      user_id: uuid,
      client_id: process.env.CLIENT_ID
    }, {
      headers: { 'Authorization': `Bearer ${token}` }
    });
    
    res.json({ success: true, redirect: '/dashboard' });
    
  } catch (error) {
    console.error('Login failed:', error);
    res.status(401).json({ success: false, message: 'Authentication failed' });
  }
});

app.post('/logout', async (req, res) => {
  try {
    const { userId, accessToken } = req.session;
    
    await axios.post(`${WEBXCOM_API}/v1/oauth/status/logout`, {
      user_id: userId,
      client_id: process.env.CLIENT_ID
    }, {
      headers: { 'Authorization': `Bearer ${accessToken}` }
    });
    
    req.session.destroy();
    
    res.json({ success: true, redirect: '/' });
    
  } catch (error) {
    console.error('Logout status update failed:', error);
    req.session.destroy();
    res.json({ success: true, redirect: '/' });
  }
});

app.listen(3001, () => console.log('App running on port 3001'));