K6 Server gRPC streaming with accesstoken metadata

I am trying to use Server gRPC streamin. How can i pass accesstoken in stream method ??

Hi @irfanspursll !

Welcome to the community forums! :wave:

If your access token is stored in metadata, you could use the params argument of the Stream class.

Stream(client, url, [,params])

The params object documentation is there Params | Grafana k6 documentation.

P.S. While checking your case, I found that our documentation lacks these details. So I’ve also opened the PR gRPC Stream class docs by olegbespalov · Pull Request #1535 · grafana/k6-docs · GitHub to fix it.

Let me know if that helps
Cheers!

1 Like

Thankyou so much @olegbespalov . I was able to pass it using params thanx for the tip.

const params = {
    metadata: {
      'accesstoken': accessToken,
    }
  };
  
  const stream = new Stream(client, serviceName,params);

Yes, You are correct the documentation lacks the details about the params for stream call.

1 Like