Ribillion Authentication Service Documentation
Overview
The Ribillion Authentication Service provides secure, centralized authentication for all Ribillion family services under the ribillion.co.uk domain. This service is accessible at auth.ribillion.co.uk.
Built on Firebase Authentication with a custom session management layer, this service ensures secure user authentication across all Ribillion applications.
Family Services
The following services are part of the Ribillion family and use this authentication service:
- Ribillion Booking - Hotel and accommodation booking system
- Ribillion Auth - Centralized authentication service (this service)
- Additional services can be added as needed
Authentication Flow
- User visits
auth.ribillion.co.uk - User signs in or creates an account
- Authentication token is stored in a secure HTTP-only cookie
- Token is valid across all
*.ribillion.co.uksubdomains - Other services can verify the session via API
API Endpoints
POST /api/auth/login
Authenticate a user with email and password.
Request Body:
{
"email": "user@example.com",
"password": "password123"
}Response:
{
"success": true,
"user": {
"uid": "user-id",
"email": "user@example.com",
"displayName": "John Doe",
"emailVerified": true
}
}POST /api/auth/signup
Create a new user account.
Request Body:
{
"email": "user@example.com",
"password": "password123",
"displayName": "John Doe"
}GET /api/auth/me
Get current authenticated user information.
Response:
{
"user": {
"uid": "user-id",
"email": "user@example.com",
"displayName": "John Doe",
"emailVerified": true
}
}POST /api/auth/logout
Sign out the current user and clear session.
Integration Guide
To integrate authentication into your Ribillion service:
- Ensure your service is on a
*.ribillion.co.uksubdomain - Check for the authentication cookie:
ribillion_auth_token - Verify the token by calling
GET https://auth.ribillion.co.uk/api/auth/me - Include the cookie in your request headers
- Handle authentication errors and redirect to
auth.ribillion.co.uk/loginif needed
Security Features
- HTTP-only cookies prevent XSS attacks
- Secure flag ensures cookies only sent over HTTPS
- SameSite=Lax prevents CSRF attacks
- JWT tokens with expiration
- Firebase Authentication backend
- Password requirements enforced
Configuration
Environment variables required:
- FIREBASE_PROJECT_ID - Firebase project ID
- FIREBASE_SERVICE_ACCOUNT_PATH - Path to service account JSON
- NEXT_PUBLIC_FIREBASE_API_KEY - Firebase Web API key
- JWT_SECRET - Secret for JWT token signing
- AUTH_DOMAIN - Authentication domain (auth.ribillion.co.uk)
- BASE_DOMAIN - Base domain (ribillion.co.uk)
Support
For issues or questions about the authentication service, please contact the Ribillion development team.