Hello everyone,
So currently I have to design a performance test for a website that is a login portal that is responsible for handling user login and authentication, through auth0. I am currently trying to write a script for a simple login user journey, so just entering the user and password for an already created user. In the webpage when you go to the login endpoint exp. “//exampleSite/web/ProtectedWithPassport”, it goes through two redirects.
The first one is “//exampleSite/authorize?response_type=code&scope=openid%20email%20profile&client_id={clientIdValue}&redirect_uri={redirectURI}&nonce={nonceValue}&state=0”.
From this endpoint it redirects to the second endpoint exp. “//exampleSite/login?state={stateValue}&client={clientId}&protocol=oauth2&response_type=code&scope=openid%20email%20profile&redirect_uri={redirectURI}&nonce={nonceValue}”
The purpose of these redirects is to go to a login page that uses auth0 for user authentication
The problem is that I should be able to just make a get request for the first endpoint, stop it at the second redirect and get the dynamic values that it returns so that i can use them for the following login request
let response = http.get(
“//exampleSite/web/ProtectedWithPassport”,
{ redirects: 2}
);
I have removed the https from the links
The issue is that when i run the command above it goes to the first redirect, and once it, makes the request for the second redirect it return a 400 error. With the body saying that I am missing the clientId, but the clientId is clearly in the body of the request(the clientId is received automatically from the auth0 webpage it redirects to). I have tried multiple things like stopping the request at the first redirect, adding the clinetId and nonce values manualy and continuing to the second redirect, I have check the request headers thoroughly, I’ve even run the endpoints manually with postman, where they work, but the same does not work on k6. I am still new to k6, so at the moment I do not have any ideas left. Help would be greatly appreciated.