Test Auth Protection

In this section, you'll run tests to verify that your authentication checks are set up correctly.

🤔

Tests not working?

If you get stuck, contact us and our development team will work directly with you to get unblocked.

In the previous steps, you added checks to ensure that only authenticated users can access specific views. Now, let’s run a few quick tests to confirm that these protections are working as expected.

Test 1: Verify Protected Views Block Unauthenticated Access

Protected views should redirect unauthenticated users to the login page. To test this functionality, please perform the following steps:

  1. First, ensure that your user does not have an active session. To do this, execute the logout flow by entering the URL of your Logout Endpoint (e.g., http://localhost:8000/auth/logout) into your browser's address bar and press Enter.
  2. Now that your user has been logged out, enter the URL of one of your application's protected views into the browser's address bar and press Enter.
  3. If your authentication checks are working correctly, you should be redirected to the Wristband login page.

Test 2: Verify Authenticated Users Can Access Protected Views

Now let's try accessing a protected view with an authenticated user. In this case, the authentication check should pass, and the user should be able to view the protected page. To test this functionality, please perform the following steps:

  1. First, ensure that the user is logged in by entering the URL of your Login Endpoint (e.g., http://localhost:8000/auth/login) into your browser's address bar and press Enter.
  2. Complete the login flow by entering your credentials when prompted.
  3. After authenticating, you'll be redirected back to your application. At this point, you should be able to view any of your application's protected pages.

If the above tests succeed, then your authentication checks are working correctly! 🙌

Great Job

Fantastic, auth checks are at full throttle!




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!