Skip to main content
GET
/
auth
/
me
Verify Session
curl --request GET \
  --url https://api.example.com/auth/me
{
  "user": {
    "user_id": 123,
    "username": "<string>",
    "github_token": "<string>",
    "exp": 123
  }
}

Overview

Retrieve information about the currently authenticated user. This endpoint verifies the JWT token and returns the user data encoded in the token.

Authentication

This endpoint requires authentication. Include a valid JWT token in the Authorization header.
Authorization: Bearer <access_token>

Request

No request body or query parameters required. Authentication is provided via the Authorization header.

Response

user
object
Current user information from JWT token

Example Request

curl -X GET https://api.dependify.dev/auth/me \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Example Response

{
  "user": {
    "user_id": 12345678,
    "username": "octocat",
    "github_token": "gho_abc123xyz789",
    "exp": 1735689600
  }
}

Error Responses

Common Errors

Use Cases

Verify Token on App Load

Use this endpoint when your application starts to verify the stored token is still valid:
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;
  }
};

Check Token Expiration

The exp field contains the Unix timestamp when the token expires. Check if renewal is needed:
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;
};

Build docs developers (and LLMs) love