Routes¶
bluefox_auth.routes
All routes are mounted under the configured prefix (default /auth).
POST /register¶
Create a new user account.
Request body (RegisterRequest):
Response (201): UserResponse
Errors:
409— Email already registered422— Invalid email, password too short (< 8 chars), or password exceeds 72 bytes
POST /login¶
Authenticate with email and password. Returns tokens in the JSON body and sets HttpOnly cookies.
Request body (LoginRequest):
Response (200): TokenResponse
Cookies set: bf_access_token, bf_refresh_token, bf_csrf_token
Errors:
401— Invalid credentials (same message for wrong email or wrong password)
POST /refresh¶
Rotate a refresh token. Accepts the token from JSON body or from the refresh cookie.
Request body (optional, RefreshRequest):
If no JSON body is provided, the refresh token is read from the bf_refresh_token cookie. When using cookie transport, CSRF validation is required — send the X-CSRF-Token header.
Response (200): TokenResponse
Errors:
401— Invalid, expired, or revoked refresh token; token reuse detected403— Missing CSRF token (cookie transport only)
POST /logout¶
Revoke the token family and clear auth cookies. Works with or without authentication.
Request body (optional, LogoutRequest):
If no JSON body is provided, the refresh token is read from the cookie. Invalid tokens are silently ignored.
Response (200):
GET /me¶
Return the current user's profile. Requires authentication.
Response (200): UserResponse
{
"id": 1,
"email": "user@example.com",
"is_active": true,
"is_superuser": false,
"email_verified": false
}
Errors:
401— Not authenticated or user inactive
POST /password-reset¶
Request a password reset email. Always returns the same response regardless of whether the email exists.
Request body (PasswordResetRequest):
Response (200): MessageResponse
Errors:
501— Password reset not configured (nopassword_reset_send_fnprovided)
POST /password-reset/confirm¶
Confirm a password reset with the token from the email.
Request body (PasswordResetConfirm):
Response (200): MessageResponse
Errors:
400— Invalid, expired, or already-used reset token422— Password too short or exceeds 72 bytes
POST /email-verification¶
Request a verification email. Requires authentication. Short-circuits if already verified.
Response (200): MessageResponse
Errors:
401— Not authenticated501— Email verification not configured (noemail_verify_send_fnprovided)
POST /email-verification/confirm¶
Confirm email verification with the token from the email.
Request body (EmailVerificationRequest):
Response (200): MessageResponse
Errors:
400— Invalid, expired, or already-used verification token