POST /auth/validate

Validate a JWT token from RegardingWork Hub

Back to API Docs

Description

Validates a JWT token issued by RegardingWork Hub service and returns user information if valid.

Endpoint URL
POST https://premium.regardingwork.com/auth/validate
Authentication

None required

Request

Headers
Content-Type: application/json
Request Body
{
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."  // Required: JWT token from Hub
}

Response (200 OK)

{
  "valid": true,
  "user": {
    "user_id": 7,
    "username": "testhub",
    "bio": "Test user profile",
    "is_active": true,
    "role": "superadmin"
  }
}

Error Responses

400 Bad Request
{
  "error": "Token is required"
}
401 Unauthorized
{
  "valid": false,
  "error": "Invalid or expired token"
}

Code Examples

JavaScript (Fetch)
const response = await fetch('https://premium.regardingwork.com/auth/validate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    token: 'your_jwt_token_here'
  })
});

const result = await response.json();
if (result.valid) {
  console.log('User:', result.user);
} else {
  console.error('Invalid token');
}
cURL
curl -X POST https://premium.regardingwork.com/auth/validate \
  -H "Content-Type: application/json" \
  -d '{
    "token": "your_jwt_token_here"
  }'

Related Endpoints