cURL
curl --request GET \ --url https://api.example.com/auth/me
{ "user": { "user_id": 123, "username": "<string>", "github_token": "<string>", "exp": 123 } }
Get current authenticated user information
Authorization: Bearer <access_token>
Show user properties
curl -X GET https://api.dependify.dev/auth/me \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
{ "user": { "user_id": 12345678, "username": "octocat", "github_token": "gho_abc123xyz789", "exp": 1735689600 } }
Show 401 Unauthorized - Missing Token
{ "detail": "Not authenticated" }
Show 401 Unauthorized - Invalid Token
{ "detail": "Invalid token" }
Show 401 Unauthorized - Expired Token
{ "detail": "Token has expired" }
Show 401 Unauthorized - Invalid Credentials
{ "detail": "Invalid authentication credentials" }
const verifyToken = async (token) => { try { const response = await fetch('https://api.dependify.dev/auth/me', { headers: { 'Authorization': `Bearer ${token}` } }); if (response.ok) { const data = await response.json(); return data.user; } // Token is invalid, redirect to login return null; } catch (error) { console.error('Token verification failed:', error); return null; } };
exp
const isTokenExpiringSoon = (exp) => { const expirationDate = new Date(exp * 1000); const now = new Date(); const hoursDiff = (expirationDate - now) / (1000 * 60 * 60); // Return true if token expires in less than 1 hour return hoursDiff < 1; };