EduShade
Auth Module

Authentication Module - Overview

Complete guide to the EduShade Authentication & Authorization system

Authentication Module

The Authentication Module is the core identity and access management system of the EduShade platform. It handles everything from user registration and login to role-based access control (RBAC) and admin user management.

What This Module Covers

FeatureDescription
RegistrationCreate new accounts via email, phone, or social login
LoginSign in with email/username + password or phone OTP
OAuth & Social LoginSign in with Google or Facebook (Apple/GitHub supported by the backend but not yet enabled in the UI)
Email VerificationVerify your email address via OTP or link
Phone VerificationVerify your phone number via SMS OTP
Password ManagementForgot password, reset password, change password
Account ManagementEdit profile, change email/phone, update avatar
Session ManagementView active sessions, manage devices, terminate sessions
Roles & Permissions (RBAC)Role-based access control with granular permissions
User Management (Admin)Admin tools for creating, editing, and managing users
User ImpersonationAdmin can act as another user — two modes: Impersonation (read-only) and Masquerade (full access)
Security FeaturesBrute force protection, rate limiting, account lockout
Profile CompletionRequired profile fields and completion workflow
Account DeletionSelf-service and admin account deletion
User AnalyticsUser growth stats, registration trends, quick overview
Auth Page CustomizationTenant-controlled image shown on the login/register/verify pages

Architecture Overview

The authentication system is built as a standalone microservice (auth-service) that communicates with the frontend (Next.js) and other backend services.

Key Components

  • Backend: Go (Gin framework) with Bun ORM on PostgreSQL
  • Frontend: Next.js with React, using custom auth hooks and context providers
  • Token System: JWT-based authentication with access + refresh token pairs
  • Multi-Tenancy: Full tenant isolation — every user, role, and session is scoped to a tenant

User Types

EduShade supports three user types, and a single user can hold multiple types simultaneously:

TypeFlagDefaultDescription
Learneris_learnertrueStudents who enroll in courses and learning paths
Instructoris_instructorfalseTeachers who create and manage course content
Adminis_adminfalsePlatform administrators with management access

User type flags are independent of RBAC roles. Flags determine which area of the platform a user can enter (/dashboard vs /admin). Roles & Permissions determine what they can do once inside.

User Statuses

StatusDescription
pending_verificationAccount created, awaiting email/phone verification
activeFully verified and active account
inactiveTemporarily deactivated account
suspendedAccount suspended by an administrator
deletedSoft-deleted account (data retained per policy)

How Authentication Works (High-Level Flow)

1. User registers → Account created (status: pending_verification)
2. User verifies email/phone → Account activated (status: active)
3. User logs in → JWT access token + refresh token issued
4. Frontend stores tokens → Used for all authenticated API requests
5. Token expires → Auto-refreshed using refresh token
6. User logs out → Session invalidated, tokens cleared

Getting Started

If you're a new user, start with:

  1. Registration — Create your account
  2. Email Verification — Verify your email
  3. Login — Sign in to the platform
  4. Profile Completion — Complete your profile

If you're an administrator, also read:

  1. User Management — Manage platform users
  2. Roles & Permissions — Configure access control
  3. User Impersonation — Support users by logging in as them
  4. User Analytics — Monitor user growth and activity

On this page