Skip to main content

Test Accounts

Test Accounts allow you to log in with static verification codes during development and testing phases. This feature simplifies the authentication flow when testing your application by providing predictable OTP codes and designated test credentials.

Enabling this option permits login through the provided email, OTP code, or phone number. Note that these accounts are designated for testing only and should not be used in production/ storing funds.

Test Accounts Settings

Enabling Test Accounts

Test Accounts can be enabled through the Web3Auth Dashboard:

  1. Navigate to your project in the Web3Auth Dashboard
  2. Go to Project Settings > Advanced
  3. Locate the Test Accounts section
  4. Toggle the Enable Test Accounts option

Test Account Types

Email Authentication

When Test Accounts are enabled, each test account is assigned a unique email address in the format test_account_XXXX@example.com, where XXXX represents a randomly generated number. You can use these test email addresses to authenticate using email passwordless OTP login.

Phone Number Authentication

When Test Accounts are enabled, each test account is assigned a unique phone number in the format +1 (555) XXX-XXXX, where XXX-XXXX represents a randomly generated number. You can use these test phone numbers to authenticate using SMS OTP login.

Static OTP Code

When using Test Accounts, a static OTP verification code is generated and displayed in your project dashboard. This code remains constant for both email and phone number test accounts.

Usage in Development

Email + OTP Flow

  1. Enter a test email (e.g., test_account_XXXX@example.com)
  2. Click "Send Code" or equivalent button
  3. Enter the static OTP: XXXXXX
  4. Complete the authentication flow

SMS + OTP Flow

  1. Enter a test phone number (e.g., +1 (555) XXX-XXXX)
  2. Click "Send Code" or equivalent button
  3. Enter the static OTP: XXXXXX
  4. Complete the authentication flow

Benefits for Development

Consistent Testing Experience

  • Predictable Credentials: Same OTP code (XXXXXX) works every time
  • No External Dependencies: No need to access email or SMS during testing
  • Faster Iteration: Streamlined testing without waiting for delivery of verification codes

Team Collaboration

  • Shared Test Accounts: Team members can use the same test credentials
  • Standardized Testing: Consistent testing experience across the development team
  • Demo-Friendly: Reliable for demonstrations and presentations

CI/CD Integration

  • Automated Testing: Enables automated tests that require authentication flows
  • E2E Testing: Facilitates end-to-end testing scenarios
  • Staging Validation: Supports testing in staging environments

Security Considerations

Best Practices

  • Never use Test Accounts in production - they are designed for testing only and could expose your application to security vulnerabilities if used in production
  • Disable before going live - ensure Test Accounts are turned off before production deployment
  • Use separate projects - maintain separate projects for development and production environments
  • Document test credentials - clearly document which credentials are for testing only

Troubleshooting

If Test Accounts are not functioning as expected:

  1. Verify Environment: Ensure you're using your particular Sapphire Devnet or Sapphire Mainnet environment where test accounts are enabled.
  2. Check Project Settings: Confirm Test Accounts are enabled in Project Settings > Advanced
  3. Email or Phone: Ensure test email or phone number is correct as mentioned in the dashboard, you can refresh the credentials by clicking on the refresh button.
  4. OTP Code: Always use XXXXXX as the verification code as mentioned in the dashboard