# QueryParamToken - Access to the parameter

**URL:** <https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310>\
**Category:** Making Packs\
**Created:** [January 20, 2022, 10:06pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310 "2022-01-20T22:06:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![j.b\_o](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/j.b_o/32/20739_2.png) [@j.b\_o](https://connect.superhuman.com/u/j.b_o)\
**Post date:** [January 20, 2022, 10:06pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/1 "2022-01-20T22:06:44Z")

</div>

Hello,

When we use setUserAuthentication with :  
`type: coda.AuthenticationType.QueryParamToken,`

Is there a way to access the parameter throught the context in a formula?  
I have check this but there is nothing about that :

> **[Coda Pack SDK](https://coda.io/packs/build/latest/reference/sdk/interfaces/SyncExecutionContext/)**
>
> Documentation for the SDK to build Coda Packs.

Thank you in advance

---

<div class="post-metadata">

**Author:** ![Leandro\_Zubrezki](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/leandro_zubrezki/32/35032_2.png) [@Leandro\_Zubrezki](https://connect.superhuman.com/u/Leandro_Zubrezki)\
**Post date:** [January 20, 2022, 10:09pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/2 "2022-01-20T22:09:27Z")

</div>

For security purposes Coda handles all the authentication, you won’t be able to access the token the user provided.

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [January 20, 2022, 10:18pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/3 "2022-01-20T22:18:54Z")

</div>

@Leandro_Zubrezki is correct, Pack developer don’t have direct access to user credentials.

@j.b_o - Can you provide more context on why you would need / want to access that value in your Pack code?

---

<div class="post-metadata">

**Author:** ![j.b\_o](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/j.b_o/32/20739_2.png) [@j.b\_o](https://connect.superhuman.com/u/j.b_o)\
**Post date:** [January 21, 2022, 9:12am UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/4 "2022-01-21T09:12:02Z")

</div>

@Leandro_Zubrezki @Eric_Koleda Thank you for the quick answers.  
I understand well the security purpose.

I’m working on a pack to access to the Plex API.  
When i request to the playlists information for example, i get a response like :

```auto
{
	"MediaContainer": {
		"size": 2,
		"Metadata": [
			{
				"title": "Playlist 1",
				"playlistType": "audio",
				"composite": "/path_to_the_playlist_1_cover",
			},
			{
				"title": "Playlist 2",
				"playlistType": "audio",
				"composite": "/path_to_the_playlist_2_cover",
			},
			{
			}
		]
	}
}

```

It’s ok with the response and i would like to get the cover into a column (“compose”).  
I know i can access to the cover through the url:  
`endpoint + "/path_to_the_playlist_1_cover?token=" + token`

That is the url i try to build…  
But as far as i understand, i have to make a second request and try to use the **temporaryBlobStorage** property, don’t i? 🧐

PS :  
By the way, actually i stringify the response to explicit the data structure and because i didn’t succeed to access to the data with the formula directly, for exemple:  
`MyPlaylist("My Plex").Metadata` doesn’t work so i use `MyPlaylist("My Plex").ParseJSON(Metadata)`. It’s work but it add a new formula step 🤷

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [January 21, 2022, 3:39pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/5 "2022-01-21T15:39:27Z")

</div>

> [@j.b\_o](#):
>
> But as far as i understand, i have to make a second request and try to use the **temporaryBlobStorage** property, don’t i? 🧐

Yes, the approach here would be to fetch the images in your code, which would apply the user’s credentials, and then store the images in temporary blob storage. You’d want to then return the image as the type `ImageAttachment`, so that Coda ingests the temporary URL into a more permanent one. Be aware though that this approach will only work within a sync table ([see here](https://coda.io/packs/build/latest/guides/basics/data-types/#images)). If this is in a formula then there isn’t a great way to deal with images that require authentication.

Instead of returning stringified JSON, the better approach would be to return an object defined by a schema ([see here](https://coda.io/packs/build/latest/guides/basics/data-types/#objects)).

---

<div class="post-metadata">

**Author:** ![j.b\_o](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/j.b_o/32/20739_2.png) [@j.b\_o](https://connect.superhuman.com/u/j.b_o)\
**Post date:** [January 21, 2022, 4:57pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/6 "2022-01-21T16:57:22Z")

</div>

Thank you very much for the information. I will try it later.  
I note the limitation of this approach in a formula.  
To bypass the limitation, is there a way to use a sync table which depends of a parameter?

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [January 21, 2022, 5:12pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/7 "2022-01-21T17:12:27Z")

</div>

Sync tables can take parameters, but they are usually designed to sync a large number of records, vs targeting single ones.

---

<div class="post-metadata">

**Author:** ![j.b\_o](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/j.b_o/32/20739_2.png) [@j.b\_o](https://connect.superhuman.com/u/j.b_o)\
**Post date:** [January 23, 2022, 10:28pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/8 "2022-01-23T22:28:06Z")

</div>

Thank you @Eric_Koleda.

About the TemporaryBlobStorage, i am not familiar with it.  
I try to use storeBlob and storeURL without success:

```auto
const compositeurl = endpoint + "" + library.composite;
let responsecover = await context.fetch(compositeurl);
let blob = await responsecover.blob();
let coverurl = storeBlob(blob, {type: 'image/png'},"");

```

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [January 24, 2022, 4:31pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/9 "2022-01-24T16:31:00Z")

</div>

Unfortunately we haven’t written up much documentation on this feature yet, but the code would look like this:

```auto
let response = await context.fetcher.fetch({
  method: "GET",
  url: imageUrl,
  isBinaryResponse: true,
});
let buffer = response.body;
let contentType = response.headers["content-type"] as string;
let tempUrl = await context.temporaryBlobStorage.storeBlob(buffer, contentType);

```

---

<div class="post-metadata">

**Author:** ![j.b\_o](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/j.b_o/32/20739_2.png) [@j.b\_o](https://connect.superhuman.com/u/j.b_o)\
**Post date:** [January 25, 2022, 1:01pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/10 "2022-01-25T13:01:19Z")

</div>

> [@Eric\_Koleda](#):
>
> ```auto
> let response = await context.fetcher.fetch({
> method: "GET",
> url: imageUrl,
> isBinaryResponse: true,
> });
> let buffer = response.body;
> let contentType = response.headers["content-type"] as string;
> let tempUrl = await context.temporaryBlobStorage.storeBlob(buffer, contentType);
> 
> ```

Thank you @Eric_Koleda .  
It works perfectly well 😉

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/system/32/24484_2.png) [@system](https://connect.superhuman.com/u/system)\
**Post date:** [January 28, 2022, 1:01pm UTC](https://connect.superhuman.com/t/queryparamtoken-access-to-the-parameter/28310/11 "2022-01-28T13:01:55Z")

</div>

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