FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
lightweight
lightweightglimpse2-runbook-view-glimpse-save-login-react
Remix of lightweight/glimpse2-runbook-view-glimpse-save-login
Public
Like
glimpse2-runbook-view-glimpse-save-login-react
Home
Code
8
_townie
13
backend
7
frontend
1
shared
1
.vtignore
README.md
deno.json
H
main.tsx
Branches
2
Pull requests
Remixes
History
Environment variables
6
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
backend
/
routes
/
glimpse
/
README.md
Code
/
backend
/
routes
/
glimpse
/
README.md
Search
9/5/2025
Viewing readonly version of main branch: v1
View latest version
README.md

Glimpse Routes

This module provides shortcut routes for accessing glimpse functionality and user authentication.

Routes

  • GET /login - User-specific login redirect with auto-registration
  • GET /thanks - New user welcome page
  • GET /:id - Get page data by ID (equivalent to /views/glimpse/:id)

Authentication

  • Requires user authentication via authCheck middleware
  • Same authentication requirements as the original /views/glimpse/:id route

Login Route (/login)

Purpose

Provides personalized redirect functionality for authenticated users with automatic user registration.

Flow

  1. User must be authenticated (Google OAuth via LastLogin)
  2. System extracts user's email from authentication context
  3. Queries GLANCE_DEMOS_DB_ID database for user's record
  4. If user found: Extracts redirect URL and redirects to personal URL
  5. If user not found: Creates new user record and redirects to /thanks

Database Requirements

The GLANCE_DEMOS_DB_ID database must contain:

  • Email property: User's email address (exact match with authenticated email)
  • URL property: User's redirect URL (optional for new users)

Supported URL Properties

  • Property names: URL, Link, Redirect URL, Demo URL, url, link
  • Property types: url, rich_text, title

Error Handling

  • User creation fails: Shows access denied HTML page with technical details
  • Missing URL: Returns JSON error with debugging information
  • Invalid URL: Returns JSON error with validation details
  • Database errors: Returns JSON error with technical details

Environment Variables

  • GLANCE_DEMOS_DB_ID - Required Notion database ID for user lookup

Thanks Route (/thanks)

Purpose

Welcome page for newly registered users explaining next steps.

Features

  • Confirms successful account creation
  • Shows user's registered email address
  • Explains admin review process
  • Provides timeline expectations (1-2 business days)
  • Includes support contact information

Access

  • Requires authentication (redirects to dashboard if not authenticated)
  • Typically accessed via redirect from /login after user creation

Data Route (/:id)

Parameters

  • id (string, required) - The Notion page ID to retrieve

Response

Returns JSON response with page data from Notion API, with button properties filtered out.

Usage

This module provides multiple access patterns:

  • Auto-registration: /glimpse/login - Personalized user redirect with automatic signup
  • Welcome flow: /glimpse/thanks - New user onboarding
  • Data access: /glimpse/{page-id} - Shortcut to /views/glimpse/{page-id}

The login route transforms the user experience from "access denied" to "welcome, you're registered" for new users.

Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.