# Same access token for all user request

**URL:** <https://community.gatling.io/t/same-access-token-for-all-user-request/8371>\
**Category:** Gatling (Open-Source)\
**Tags:** gatling-academy\
**Created:** [October 16, 2023, 5:57pm UTC](https://community.gatling.io/t/same-access-token-for-all-user-request/8371 "2023-10-16T17:57:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![partheeban](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@partheeban](https://community.gatling.io/u/partheeban)\
**Post date:** [October 16, 2023, 5:57pm UTC](https://community.gatling.io/t/same-access-token-for-all-user-request/8371/1 "2023-10-16T17:57:07Z")

</div>

I am testing an API which has access token . Access token is service token, so irrespective of how many users , only one access token will be created. So i want to create only one access token .

how can i achieve it.

Currently i have two scenarios class , one for accessToken and actualApi. In the simulation class , i use  
accessToken followed by actualApi in the SetUp method.  
Even though I am able to generate access\_token , i am not able to pass that to `accessToken` to actual API here.

---

<div class="post-metadata">

**Author:** ![sbrevet](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/sbrevet/32/830_2.png) [@sbrevet](https://community.gatling.io/u/sbrevet)\
**Post date:** [October 16, 2023, 6:38pm UTC](https://community.gatling.io/t/same-access-token-for-all-user-request/8371/2 "2023-10-16T18:38:51Z")

</div>

Hi @partheeban,

@GeMi was kind enough to implement a full example:

> [@Token Refresh - Java - Example](https://community.gatling.io/t/token-refresh-java-example/7935):
>
> I see that lot of people asking about solution to refresh Token when expired. I have prepared Case0022SetOrRefreshTokenSimulation where Token is refreshed every some period of time. What you think about this solution @slandelle @sbrevet ?

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/b/b148e0742de35c6280726cabf3ecd3de2d320f63.png) [@system](https://community.gatling.io/u/system)\
**Post date:** [November 15, 2023, 6:39pm UTC](https://community.gatling.io/t/same-access-token-for-all-user-request/8371/3 "2023-11-15T18:39:03Z")

</div>

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