Skip to main content

Authentication

Cocobase provides a complete authentication system with user registration, login, session management, and profile handling. No complex setup required - just use the built-in auth methods.

Quick Start

User Registration

Create new user accounts with email and password:
Response:
Password requirements: - Minimum 8 characters - At least one uppercase letter
  • At least one lowercase letter - At least one number

User Login

Authenticate users and get access tokens:
With automatic token persistence:

Get Current User

Retrieve the currently authenticated user:

Update User Profile

Update user data after authentication:

Logout

End the user session:

Password Management

Change Password

Request Password Reset

Reset Password with Token

OAuth Authentication

Authenticate users with Google, GitHub, and other OAuth providers:
Supported OAuth Providers:
  • Google
  • GitHub
  • Facebook
  • Twitter
  • Microsoft
  • Apple

Two-Factor Authentication (2FA)

Enable 2FA

Login with 2FA

Email Verification

Verify user email addresses to ensure account authenticity and improve security.
Email verification can be enforced globally in your project settings. When enabled, users will have limited access until their email is verified.

Role-Based Access Control

Manage user roles and permissions:

Authentication with React

Complete example for React applications:

Authentication with Flutter

Complete example for Flutter applications:

Error Handling

Common authentication errors and how to handle them:

Best Practices

Never store passwords in plain text. Use environment variables and secure storage:
Tokens are automatically stored securely: - Browser: localStorage (with HttpOnly flag) - Mobile: Secure storage (Keychain/Keystore) - Server: Memory or secure storage backend
Implement automatic token refresh and session validation:
Enforce strong password requirements:
  • Minimum 8 characters
  • Mix of uppercase, lowercase, numbers
  • Consider special characters
  • Implement password strength meter

Next Steps

CRUD Operations

Learn to create, read, update, and delete data

User Profiles

Build complete user profile management

Protected Routes

Secure your application routes

Social Login

Implement OAuth authentication