/api/auth.
Authentication methods
Gitflare supports the following authentication methods:- Email and password authentication
- Session-based authentication with secure cookies
- Personal access tokens for Git operations
Base URL
All authentication endpoints are relative to your Gitflare instance:Sign up
Create a new user account with email and password.Request body
User’s email address. Must be a valid email format.
User’s password. Must be at least 8 characters long.
User’s display name. Must be at least 2 characters long.
Unique username for the user. Must be at least 3 characters long. This username will be used in repository URLs (e.g.,
username/repo).Response
The created user object.
Session information for the authenticated user.
Sign in
Authenticate an existing user with email and password.Request body
User’s email address.
User’s password.
Response
Returns the same user and session structure as sign up.Get session
Retrieve the current authenticated user’s session information.Response
The authenticated user object with all user properties.
Current session information including token and expiration.
null if no active session exists.
Sign out
End the current user session.Response
Indicates whether the sign-out was successful.
Update user
Update the authenticated user’s profile information.Request body
User’s display name. Must be at least 2 characters.
Username and email cannot be changed after account creation.
Response
Returns the updated user object.Authentication flow
Gitflare uses session-based authentication with secure HTTP-only cookies:- Sign up or sign in: User provides credentials via POST request
- Session creation: Server creates a session and sets an HTTP-only cookie
- Authenticated requests: Browser automatically includes the session cookie
- Session validation: Server validates the session on each request
- Sign out: Session is invalidated and cookie is cleared
Security features
- HTTP-only cookies: Session tokens are stored in HTTP-only cookies, preventing XSS attacks
- Secure cookies: Cookies are only transmitted over HTTPS in production
- Password hashing: Passwords are securely hashed using industry-standard algorithms
- Session expiration: Sessions automatically expire after a period of inactivity
Using authentication in your application
With the Better Auth client
Gitflare uses the Better Auth React client for seamless authentication:For Git operations
For Git operations (push, pull, clone), use personal access tokens instead of password authentication:Error responses
Authentication endpoints return standard HTTP error codes:Error information when a request fails.
Common error codes
400 Bad Request: Invalid request parameters or validation errors401 Unauthorized: Invalid credentials or expired session409 Conflict: Email or username already exists (during sign up)500 Internal Server Error: Server-side error
See also
- Personal Access Tokens - Generate tokens for Git operations
- Access Control - Manage repository permissions
- Better Auth Documentation - Learn more about the authentication system