Files
msa-django-nhn/nhn/utils.py
icurfer 8c7739ffad
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Add NHN Cloud API integration with async task support
- NHN Cloud API packages: token, vpc, compute, nks, storage
- REST API endpoints with Swagger documentation
- Async task processing for long-running operations
- CORS configuration for frontend integration
- Enhanced logging for debugging API calls

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 01:29:21 +09:00

32 lines
839 B
Python

import requests
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
def verify_token_with_auth_server(token: str):
"""
Verify token with external auth server.
"""
url = settings.AUTH_VERIFY_URL
if not url:
logger.warning("AUTH_VERIFY_URL is not configured.")
return None
try:
response = requests.post(
url,
json={"token": token},
headers={"Content-Type": "application/json"},
timeout=5,
)
if response.status_code == 200:
return response.json()
else:
logger.error(f"Auth server returned status {response.status_code}")
return None
except requests.RequestException as e:
logger.error(f"Failed to verify token: {e}")
return None