Test Auth Protection

Verify that your authentication checks are configured correctly.

🤔

Tests not working?

Need help? Contact our team to resolve the issue.

To verify your authentication protections, run three key tests:

  • Check frontend route blocking
  • Test backend API rejection
  • Confirm access for authenticated user

Test 1: Verify Frontend Blocks Unauthenticated Access

To verify that your frontend routes and components successfully block unauthenticated users, complete these explicit testing steps:

  1. Log out: Go to your logout URL (e.g., http://localhost:3001/auth/logout) to clear any active session.
  2. Test route: Try to visit a protected page by typing its URL into your browser bar.
  3. Verify redirect: Make sure the app sends you to the login page.

Test 2: Verify Backend Blocks Unauthenticated Access

To test your protected backend endpoints, send an unauthenticated request and verify the server rejects it.

  1. Use a tool such as cURL or Postman to send a request to a protected backend endpoint without including a valid session cookie.
  2. Verify the endpoint returns a 401 Unauthorized response.

Test 3: Verify Authenticated Users Can Access Protected Pages

To verify that authenticated users can successfully access restricted areas, complete the following steps:

  1. Start the login flow by entering the URL of your Login Endpoint, such as http://localhost:3001/auth/login, in your browser's address bar, then press Enter.
  2. Complete the login flow by entering your credentials when prompted.
  3. After authentication completes, confirm you are redirected back to your application.
    Access your application's protected pages.

If the tests above succeed, your authentication checks are working correctly.


What’s Next

Congratulations! Your application now properly enforces user authentication. But there’s still plenty more you can do with our platform - let’s explore!

Did this page help you?