You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m new to this and not entirely sure if this is the right place for my question, so any guidance is appreciated.
We have a basic authentication (HTTPS) endpoint that requires a username and password to retrieve a token, which is then used in the headers for subsequent API calls. Since the Auth endpoint has a throttling limit, allowing only a few requests per minute without errors, I’m looking for a way to call this endpoint just once, store the token, and make it accessible in our k6 test scripts as an environment variable.
Ideally, the token should be refreshed periodically. A script triggered by cron (or a similar scheduler) would be perfect for this. The goal is to avoid making an Auth request in every k6 script, but instead, have the token fetched periodically, stored, and reused across all scripts.
Any advice on how to set this up would be greatly appreciated.
I really appreciate any help you can provide.
The text was updated successfully, but these errors were encountered:
@fasatrix thanks for the question, we don't currently have a way to manage auth tokens or other secretes in this way. "secrets management" is a synthetics feature we're planning to implement, though I don't have an ETA for it.
Until then, consider using a secrets manager with an API to cache the token and then fetch it from the k6 script. For example if you're using AWS you could consider using https://grafana.com/docs/k6/latest/javascript-api/jslib/aws/secretsmanagerclient/ where you cache your token in AWS secrets manager and then use this client to fetch the token. Other secrets managers have APIs that you could use to create helper functions that operate in a similar way to this client.
Hi,
I’m new to this and not entirely sure if this is the right place for my question, so any guidance is appreciated.
We have a basic authentication (HTTPS) endpoint that requires a username and password to retrieve a token, which is then used in the headers for subsequent API calls. Since the Auth endpoint has a throttling limit, allowing only a few requests per minute without errors, I’m looking for a way to call this endpoint just once, store the token, and make it accessible in our k6 test scripts as an environment variable.
Ideally, the token should be refreshed periodically. A script triggered by cron (or a similar scheduler) would be perfect for this. The goal is to avoid making an Auth request in every k6 script, but instead, have the token fetched periodically, stored, and reused across all scripts.
Any advice on how to set this up would be greatly appreciated.
I really appreciate any help you can provide.
The text was updated successfully, but these errors were encountered: