Skip to main content

Authentication Overview

UCF GeoLens uses Supabase for user authentication. All application routes are protected — unauthenticated users are redirected to the login page on every page load.

Auth Flow

User visits geo-lens.net


index.html loads supabase-auth.js


checkAuthState() ──► No session? ──► Redirect to /login.html

Session found


App initializes (sidebar, Cesium map, etc.)

Key Files

FilePurpose
auth/supabase-auth.jsAll auth functions: register, login, logout, session check, password reset
auth/supabase-config.jsSupabase project URL and anon key
client/public/login.htmlLogin and registration page
supabase/schema.sqlDatabase schema (run once per Supabase project)

Session Management

Supabase handles sessions via JWT tokens stored in localStorage. The checkAuthState() function calls supabase.auth.getUser() which automatically validates the stored token against the Supabase server.

Sessions persist across browser refreshes and tabs on the same origin.

Email Verification

New registrations require email confirmation before the account can be used. The app checks data.user.email_confirmed_at at login and blocks access if the address has not been verified.

Logout

The Logout button in the sidebar header calls supabase.auth.signOut() and redirects to /login.html.

Supabase Project Setup

  1. Create a free project at supabase.com
  2. Run supabase/schema.sql in the Supabase SQL editor
  3. Copy the Project URL and anon (public) key from Settings → API
  4. Paste them into auth/supabase-config.js
  5. In Supabase Authentication → URL Configuration, set the site URL to your app domain