blockFreeEmailAction
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.
This Val Town application implements a WorkOS Action that blocks authentication and user registration for users with @gmail.com email addresses.
- Get a copy of this app by clicking the Remix button in the top-right
- Set the required environment variables (see Configuration section below)
- Configure your WorkOS Dashboard to point to this action endpoint
Set these environment variables in your Val Town settings:
WORKOS_API_KEY
: Your WorkOS API keyWORKOS_ACTIONS_SECRET
: The secret generated when you configure your action endpoint in the WorkOS Dashboard
- 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
- Go to the WorkOS Dashboard
- Navigate to Actions
- Set your endpoint URL to:
https://[your-val-name].web.val.run/action
- Enable the action and save your changes
- Copy the generated secret to your
WORKOS_ACTIONS_SECRET
environment variable
Use the WorkOS Dashboard's test feature to send test actions to your endpoint and verify it's working correctly.