# Provide an example on how to achive login once do many things type of scenario using k6

**URL:** <https://community.grafana.com/t/provide-an-example-on-how-to-achive-login-once-do-many-things-type-of-scenario-using-k6/102532>\
**Category:** OSS Support\
**Created:** [August 31, 2023, 2:47am UTC](https://community.grafana.com/t/provide-an-example-on-how-to-achive-login-once-do-many-things-type-of-scenario-using-k6/102532 "2023-08-31T02:47:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanrosello-og](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@ryanrosello-og](https://community.grafana.com/u/ryanrosello-og)\
**Post date:** [August 31, 2023, 2:47am UTC](https://community.grafana.com/t/provide-an-example-on-how-to-achive-login-once-do-many-things-type-of-scenario-using-k6/102532/1 "2023-08-31T02:47:56Z")

</div>

This was posted over a year ago:

> [@Login once for multiple scenarios](https://community.grafana.com/t/login-once-for-multiple-scenarios/97080):
>
> Hi I’ve been looking though all the resources I can and haven’t been able to find and agreeable solution to what I’m trying to achieve. I want to run scenarios which emulates our users real world usage, this requires certain actions being taken periodically. I wanted to be able to login with my user once and then perform different actions based on the setup of scenarios, in order to get this working I’d need to be able to login before the scenarios kick off due to the lack of ability to share …

Basically, I’m trying to emulate the following user behaviour:

An editor login into a Content Management System once per day.  
Using the same session throughout the day, they would do a bunch of things:

_Create pages, modify pages, publish pages etc._

But instead of a single editor, this would be many editors:  
Ramp up from 0 to 50 VU in the first 30 minutes  
Increment from 50 to 350 editors (VU) next 30 minutes  
Sustain for 60 minuts  
Then ramp down to zero

How can I achieve this using k6, do you have some documentation or github examples?

---

<div class="post-metadata">

**Author:** ![richmarshall](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@richmarshall](https://community.grafana.com/u/richmarshall)\
**Post date:** [September 2, 2023, 12:25am UTC](https://community.grafana.com/t/provide-an-example-on-how-to-achive-login-once-do-many-things-type-of-scenario-using-k6/102532/3 "2023-09-02T00:25:35Z")

</div>

The [example for “Advanced API flow”](https://k6.io/docs/examples/advanced-api-flow/) demonstrates generating an authToken in the setup function and passing the data to the default function where multiple operations take place.

---

<div class="post-metadata">

**Author:** ![ryanrosello-og](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@ryanrosello-og](https://community.grafana.com/u/ryanrosello-og)\
**Post date:** [September 2, 2023, 2:14am UTC](https://community.grafana.com/t/provide-an-example-on-how-to-achive-login-once-do-many-things-type-of-scenario-using-k6/102532/4 "2023-09-02T02:14:01Z")

</div>

thanks @richmarshall, this is exactly what I was looking for 😃
