Test Auth Protection
This section guides you through authentication testing.
Tests not working?Stuck? Contact us for direct developer support.
Now that frontend and backend authentication checks are in place, you can now run a few quick tests to validate the configuration.
Test 1: Verify Frontend Blocks Unauthenticated Access
To confirm that unauthenticated users are barred from protected frontend routes and components, perform these steps:
- First, terminate any active sessions. Input your Logout Endpoint URL (e.g.,
http://localhost:3001/auth/logout) into the browser address bar and execute the command. - Following session termination, enter the URL of a protected application route into the browser address bar to verify access restrictions.
- If the authentication checks are functioning as intended, you should be redirected to the application's login page.
Test 2: Verify Backend Blocks Unauthenticated Access
Protected backend endpoints should return a 401 Unauthorized status code if the request lacks a valid session cookie. Perform these steps to verify this behavior:
- Execute a request to a protected backend endpoint using cURL or Postman, intentionally omitting a valid session cookie from the headers.
- Validate that the server response status is exactly 401 Unauthorized.
Test 3: Verify Authenticated Users Can Access Protected Pages
To confirm that authenticated users can successfully view protected pages, execute these steps:
- First, verify that the user is authenticated. Input your Login Endpoint URL (e.g.,
http://localhost:3001/auth/login) into the address bar and press Enter. - Complete the authentication process by entering your credentials at the prompt.
- Upon successful authentication, you will be redirected back to the application, granting you access to all protected pages.
If the above tests are successful, it indicates that your authentication checks are functioning correctly.
Updated about 1 hour ago
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!