Skip to content

Setup test user and environment

Before you begin testing your application with Kinde authentication, you need to set up dedicated test users and configure your test environment. This setup is common across all testing methods, whether you’re testing backend APIs, authentication flows, or authenticated features.

  • A Kinde account with admin access (Sign up for free)

Why separate test users and environments?

Link to this section

Using dedicated test infrastructure for automated testing provides several benefits:

  • Data isolation: Test data doesn’t mix with production user data
  • Reliability: Tests won’t be affected by real user activity
  • Security: Test credentials are separate from production credentials
  • Compliance: Easier to manage test data retention and privacy requirements
  • Stability: Test users can be configured with specific permissions and settings

Step 1: Create a test environment

Link to this section

Kinde allows creating multiple non-production environments. This is useful for testing in different environments without having to sign up for a new account.

  1. Sign in to your Kinde dashboard and select the Production dropdown. A pop-up appears.
    • Select All environments
    setup test environment in kinde
  2. Select Add environment. A pop-up appears.
  3. Enter the environment name and code (e.g., “Test”)
  4. Select Save

You are now in the test environment.

Step 2: Create a test user

Link to this section
  1. Go to the Users tab and select Add user
  2. Enter test user details:
    • First name and Last name: (e.g., “John Doe”)
    • Email: Use a clear test email (e.g., e2e-test@yourcompany.com)
  3. Select Save

Repeat this process for each test user you need to create.

Step 3: Create test application credentials

Link to this section

You will need the client ID, client secret, and access token when running certain tests.

  1. Go to your Kinde dashboard and select Add application

  2. Enter a name for the application (e.g., “Test Application”)

  3. Select the application type (e.g., “Back-end web”)

  4. Select Save

  5. On the Quick start page, select a technology (e.g., “Next.js”) and select Save

  6. Configure the callback URLs

  7. Go to Authentication:

    1. Uncheck Email + code
    2. Check Email + password email password authentication in kinde
  8. Select Save

    Optional: Go to Tokens to configure a custom token expiration time for this application.

Step 4: Finish test user account creation

Link to this section
  1. Set up and run your test application
  2. Sign in with the test user you created
  3. Verify the email address and set up a strong password
  4. Store the test user email and password for use in your tests

Kinde starter test application

Link to this section

If you are creating your tests from scratch, you can use the Kinde Next.js end-to-end test application to get started.

Best practices

Link to this section
  • Document test resources: Keep track of test users, applications, and their purposes
  • Regular maintenance: Rotate test credentials periodically and clean up unused test data
  • Clear naming: Use consistent naming conventions for easy identification

After completing the above steps, you now have:

  • A test environment
  • A test user with email and password
  • A test application

You can now start testing your application with Kinde authentication.