0

I want to add the Okta token's received from a redirected URL to another domain as cookies in the same thread group. I have tried the following and not working

  1. Add HTTP Cookie Manager under Test Plan
  2. Add HTTP Cookie Manager under Thread group
  3. Add the tokens in Body data as parameters

Steps are

  1. Access Okta main page
  2. Login successful > get the token details
  3. It automatically redirected to the main domain and use the tokens as cookies

2 Answers 2

0

The key thing is another domain, JMeter's HTTP Cookie Manager stores cookies but before sending them via Cookie header it checks whether the current domain matches the one which is defined in the cookie.

If there is a match - the cookie is being sent.

So you need to inspect your cookie using either browser developer tools or enabling debug logging for the HTTP Cookie Manager and ensure that domain which is being set in the cookie matches the domain you're requesting.

If HTTP Cookie Manager isn't suitable for your use case you can always extract cookie from the Set-Cookie response header using Regular Expression Extractor and add it manually via HTTP Cookie Manager.

0

Thanks Dmitri, the below solution worked for me.

Use Regular Expression Extractor to get the cookies and manipulate the value using JSR223 PostProcessor, set the cookie using the below code -

Cookie cookie = new Cookie ("token",variable,"domain","/", false,0)
manager.add(cookie)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.