# Apollo Sandbox, Subscription and connectionParams?

**URL:** <https://community.apollographql.com/t/apollo-sandbox-subscription-and-connectionparams/5457>\
**Category:** GraphOS\
**Tags:** server, web, studio, tooling, subscriptions\
**Created:** [January 10, 2023, 9:49pm UTC](https://community.apollographql.com/t/apollo-sandbox-subscription-and-connectionparams/5457 "2023-01-10T21:49:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrDesjardins](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/mrdesjardins/32/3706_2.png) [@MrDesjardins](https://community.apollographql.com/u/MrDesjardins)\
**Post date:** [January 10, 2023, 9:49pm UTC](https://community.apollographql.com/t/apollo-sandbox-subscription-and-connectionparams/5457/1 "2023-01-10T21:49:03Z")

</div>

Hello,

I’m using the subscription pattern described in the Apollo Doc for `onConnect` and validation of JWT using the `connectionParams`. It works well when using a client that can insert the `connectionParams` information. However, the [Apollo Sandbox](https://www.apollographql.com/docs/graphos/explorer/sandbox/) does not have a user interface to insert `connectionParams`.

I tried to include the JWT inside the `headers` portion of the UI and then within the server code (onConnect) function to access the headers, but without success. No header information is provided in the onConnect argument of type `GraphQLSubscriptionContext`.

In the end, using the Apollo Sandbox has no way to pass credentials. Not by header, not by the cookie, and not by connectionParams.

What is the way to get authentication information using Apollo Sandbox on a Subscription connection?

Thank you,

---

<div class="post-metadata">

**Author:** ![watson](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/watson/32/2053_2.png) [@watson](https://community.apollographql.com/u/watson)\
**Post date:** [January 12, 2023, 8:39pm UTC](https://community.apollographql.com/t/apollo-sandbox-subscription-and-connectionparams/5457/2 "2023-01-12T20:39:49Z")

</div>

Hey @MrDesjardins, thanks for pointing this out. I brought it up to the team and we’re looking at adding something for `connectionParams`.

---

<div class="post-metadata">

**Author:** ![arviio](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/arviio/32/3717_2.png) [@arviio](https://community.apollographql.com/u/arviio)\
**Post date:** [January 13, 2023, 9:08am UTC](https://community.apollographql.com/t/apollo-sandbox-subscription-and-connectionparams/5457/3 "2023-01-13T09:08:55Z")

</div>

@watson Thanks for the fast response. I’ve been wondering how can back-end devs simulate `connectionParams` for Subscriptions without bothering front-end devs and just using Apollo Sandbox, so that when it’s given to the front-end devs, it’s ready and tested and found this thread.

```auto
const wsLink = new GraphQLWsLink(
  createClient({
    url: 'ws://localhost:4000/subscriptions',
    connectionParams: {
      authentication: user.authToken,
    },
  }),
);

```

---

<div class="post-metadata">

**Author:** ![arviio](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/arviio/32/3717_2.png) [@arviio](https://community.apollographql.com/u/arviio)\
**Post date:** [January 16, 2023, 2:11am UTC](https://community.apollographql.com/t/apollo-sandbox-subscription-and-connectionparams/5457/4 "2023-01-16T02:11:44Z")

</div>

Just in case somebody needs to make it work while Apollo team is working on `connectionParams` to be added in Apollo Sandbox, I’m currently using [https://altairgraphql.dev/](https://altairgraphql.dev/) to develop on subscriptions as they have `connectionParams`.

---

<div class="post-metadata">

**Author:** ![lseidler](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/lseidler/32/3790_2.png) [@lseidler](https://community.apollographql.com/u/lseidler)\
**Post date:** [January 30, 2023, 3:56pm UTC](https://community.apollographql.com/t/apollo-sandbox-subscription-and-connectionparams/5457/5 "2023-01-30T15:56:45Z")

</div>

We’re missing this feature too, as we currently can’t use the sandbox behind Google’s IAP protection, as it requires passing through the credentials: [Managing IAP sessions &nbsp;|&nbsp; Identity-Aware Proxy &nbsp;|&nbsp; Google Cloud](https://cloud.google.com/iap/docs/sessions-howto#ajax_requests)

---

<div class="post-metadata">

**Author:** ![ruizmarc](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/ruizmarc/32/5403_2.png) [@ruizmarc](https://community.apollographql.com/u/ruizmarc)\
**Post date:** [December 9, 2024, 1:01pm UTC](https://community.apollographql.com/t/apollo-sandbox-subscription-and-connectionparams/5457/6 "2024-12-09T13:01:18Z")

</div>

Hi! It’s almost two years since this request, any news on how to authenticate subscriptions with sandbox?

Thanks in advance 🙂
