Get Current User
Authentication
access_token - JWT token in httpOnly cookie (automatically sent by browsers)Response
Internal user ID
GitHub user ID
GitHub username (login)
User’s full name from GitHub profile
User’s email address from GitHub
URL to the user’s GitHub avatar image
ISO 8601 timestamp of when the user was created in the system
Error Responses
Not authenticated - The
access_token cookie is missingInvalid or expired token - The JWT token is invalid, malformed, or expired
User not found - The user ID from the token doesn’t exist in the database
User Model
The User model represents an authenticated user in the system.Database Schema
Primary key, auto-incremented
Unique GitHub user ID, indexed for fast lookups
GitHub username (login)
Encrypted GitHub OAuth access token. Encrypted using Fernet (AES-128-CBC + HMAC-SHA256) derived from SECRET_KEY.
User’s email address from GitHub. May be null if email is private.
URL to the user’s GitHub avatar image
User’s full name from GitHub profile
Timestamp when the user was created (UTC, with timezone)
Timestamp when the user was last updated (UTC, with timezone)
Token Encryption
GitHub access tokens are encrypted at rest using symmetric encryption for security.Implementation
Defined inapp/auth/token_encryption.py:
Encryption Details
- Algorithm: Fernet (AES-128-CBC + HMAC-SHA256)
- Key Derivation: SHA-256 hash of SECRET_KEY, encoded as URL-safe base64
- Security: Provides confidentiality and authenticity
Token Prefixes
The system recognizes these GitHub token prefixes for plaintext detection:ghp_- Personal access tokengho_- OAuth access tokenghs_- Server-to-server tokenghu_- User access tokengithub_pat_- Fine-grained personal access token
Migration Support
The decryption function gracefully handles legacy plaintext tokens. If a token cannot be decrypted but matches a GitHub token prefix, it’s returned as-is and a warning is logged. The token will be encrypted on the user’s next login.