This directory contains utility scripts for testing the email verification system.
The token-test.ts script allows you to generate and verify secure tokens for testing.
# Generate a token for a test email
npm run token-test generate test@example.com
# Verify a token
npm run token-test verify <token>
# Show help information
npm run token-test helpBy default, the script uses a test secret key. You can override this by setting the TOKEN_SECRET environment variable:
TOKEN_SECRET="your-custom-secret" npm run token-test generate test@example.comWhen generating a token:
Generated token for email: test@example.com
Token: eyJlbWFpbCI6InRlc3RAZXhhbXBsZS5jb20iLCJzaWduYXR1cmUiOiJhYmMxMjMifQ==
Verified email from token: test@example.com
Example usage in URL:
https://your-site.netlify.app/api/confirm?token=eyJlbWFpbCI6InRlc3RAZXhhbXBsZS5jb20iLCJzaWduYXR1cmUiOiJhYmMxMjMifQ%3D%3DWhen verifying a token:
Token is valid!
Email extracted from token: test@example.com- Start your local development server:
npm run dev - Generate a test token using this utility
- Use the token in your confirmation URL
- Test the complete flow in your local environment