Maintain State Between HTTP Requests to Keycloak in JMeter

Flotolk

So I am trying to automate a JMeter script that creates Keycloak users and then signs them in.

First It GETs the login page and stores the code, here is an example request:

GET http://Keycloak.com:8001//auth/realms/REALM/protocol/openid-connect/auth?response_type=code&client_id=CLIENT&scope=openid%20profile%20email&nonce=N5b3a2da23c04a&response_mode=form_post&resource=RESOURCE&state=2SJwtlVZrswlGkw&redirect_uri=REDIRECTURI

However, when I then GET the registration page, the code changes and the tab_id also changes. How can I keep keycloak from generating a new code token with every HTTP request in a thread?

In addition, why is each HTTP request with JMeter acting like a new session instead of the next request in a series?


EDIT:

I am using Regular Expression Extractors in order to track the code and execution variables, in addition to using a HTTP Cookie Manager and HTTP Cache Manager for the thread.

Looking at my POST request, both variables are the same as those from the previous HTTP request, and all of my cookies are being maintained, yet every time I try this automated login, I get a 400 error and the keycloak event log displays an invalid_code error.


Edit: As requested here is a screenshot of all my sign in requests enter image description here

UBIK LOAD PACK

Most probably your Regular Expression Extractor is not nested in the HTTP Request you are trying to extract data from.

If its scope is too wide, it applies to all HTTP Requests, so first time it succeeds extracting, but then for the next request that does not contain the token, the extractor runs and overwrites the old value by an empty one.

See scoping rules in JMeter:

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Maintain state between Vue pages

Is it possible to share pure FP state between multiple http requests on http4s server?

Run Http requests in certain order JMeter

Does Apache JMeter support http/2 requests?

How to insert time interval between requests in JMeter?

Keep file between http requests

JUnit - Do static classes maintain state between test classes?

How To Maintain SQLite Database State in Xamarin Forms Between Deploys/Builds

How to change HTTP Request Path for multiple HTTP Requests at once in Jmeter

Keep state between http request

How to acheive multiple http requests with csv file in jmeter?

Generate dynamic http requests based on the response using JMeter

JMeter: Run concurrent http requests based on user defined variable

Jmeter postProcessor to be executed only once after all the http requests are complete

How to group Http requests with transactions in Jmeter HTML Reports?

Jmeter - how to add delay between requests in concurrency thread group

Difference between Cold or Hot http requests?

Docker HTTP-requests between containers

How to share memory between HTTP requests in PHP?

Retain session between PHP HTTP Requests in PhpStorm

Distinguish between http and https requests in Google Analytics

Cannot make HTTP requests between docker containers

Saving MongoDB cursor between HTTP requests in Flask

Maintain state in controller?

How to maintain state in Erlang?

Maintain state into a asyncNotifier

How to maintain the state of a sidebar

How to test two HTTP requests in Jmeter without affecting the performance of individual requests and how to only record the results of one?

Save a session/state data between multiple requests in Service Stack framework

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    flutter: dropdown item programmatically unselect problem

  14. 14

    How to use merge windows unallocated space into Ubuntu using GParted?

  15. 15

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  16. 16

    Nuget add packages gives access denied errors

  17. 17

    Svchost high CPU from Microsoft.BingWeather app errors

  18. 18

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  19. 19

    12.04.3--- Dconf Editor won't show com>canonical>unity option

  20. 20

    Any way to remove trailing whitespace *FOR EDITED* lines in Eclipse [for Java]?

  21. 21

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

HotTag

Archive