FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
stevekrouse
stevekrouseblockFreeEmailAction
Remix of nholden/blockGmailAction
Public
Like
blockFreeEmailAction
Home
Code
8
.claude
1
backend
1
frontend
5
.vtignore
CLAUDE.md
README.md
deno.json
domains.txt
Branches
1
Pull requests
Remixes
History
Environment variables
2
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
/
README.md
Code
/
README.md
Search
7/22/2025
README.md

WorkOS Action - Block Gmail Addresses

This Val Town application implements a WorkOS Action that blocks authentication and user registration for users with @gmail.com email addresses.

Getting started

  1. Get a copy of this app by clicking the Remix button in the top-right
  2. Set the required environment variables (see Configuration section below)
  3. Configure your WorkOS Dashboard to point to this action endpoint

Configuration

Set these environment variables in your Val Town settings:

  • WORKOS_API_KEY: Your WorkOS API key
  • WORKOS_ACTIONS_SECRET: The secret generated when you configure your action endpoint in the WorkOS Dashboard

How it works

  • The WorkOS Action endpoint is at /action in /backend/index.ts
  • When WorkOS calls this endpoint during authentication or registration flows, it validates the request signature and checks the user's email
  • If the email ends with @gmail.com, the action responds with "Deny" and blocks the operation
  • All other email addresses are allowed through

WorkOS Dashboard Setup

  1. Go to the WorkOS Dashboard
  2. Navigate to Actions
  3. Set your endpoint URL to: https://[your-val-name].web.val.run/action
  4. Enable the action and save your changes
  5. Copy the generated secret to your WORKOS_ACTIONS_SECRET environment variable

Testing

Use the WorkOS Dashboard's test feature to send test actions to your endpoint and verify it's working correctly.

Further resources

  • WorkOS Actions Documentation
  • WorkOS Node.js SDK
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.