Gatling Java - Unable to handle auth token if using with more than one user

How to handle Auth_token for serial users(working with one user but failing with more than one user)
Scenario-If the website issues login token for individual user then how we can pass login token to individual thread as currently it is working with one user but failing for multiple users
See the code below

exec(
        http("GuestToken")
                .post(uri20 + "/secure/token/guest")
                .headers(headers_5)
                .check(jsonPath("$..access_token").saveAs("Access_Token")) // Saving token in this section
)

Map<CharSequence, String> headers_7 = new HashMap<>();
headers_7.put("Accept", "application/json, text/plain, */*");

headers_7.put("Pragma", "no-cache");
headers_7.put("Sec-Fetch-Dest", "empty");
headers_7.put("Sec-Fetch-Mode", "cors");
headers_7.put("Sec-Fetch-Site", "same-site");
headers_7.put("access_token", "#{Access_Token}");
headers_7.put("contract_id", "");
headers_7.put("curated_catalog_id", "");
headers_7.put("currency", "currency");
headers_7.put("foruserid", "");
headers_7.put("language", "en");
headers_7.put("preview_token", "");
headers_7.put("store_id", "OSLOESite");

We are getting below error on terminal

19:17:05.638 [ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-3' failed to execute: No attribute named 'Access_Token' is defined
19:17:05.639 [ERROR] i.g.h.a.HttpRequestAction - 'httpRequest-2' failed to execute: No attribute named 'Access_Token' is defined

Hi @agandhi!

Can you provide a SSCCE?

To really be able to help you, I need to know how you currently use this step (so, the second step) and how you linked them (in the same scenario, I expect)

Cheers!

I suspect this piece of code is just dandling and not attached to your scenario. If that’s the case, you’re missing some knowledge from the Gatling official documentation and/or Academy.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.