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
{{ message }}
This repository was archived by the owner on Apr 14, 2023. It is now read-only.
The Explorer currently enables you to authenticate via [request headers](#request-headers), [cookies](#cookies), and [preflight scripts](#preflight-scripts-beta).
28
+
The Explorer currently enables you to authenticate via [request headers](#request-headers), [cookies](#cookies), and [preflight scripts](#preflight-scripts).
29
29
30
30
> If your graph has authentication requirements that aren't covered by these options, please contact **[email protected]** with questions or feedback.
31
31
@@ -52,7 +52,7 @@ Once configured, requests sent from `https://studio.apollographql.com` will carr
52
52
53
53
### Environment variables
54
54
55
-
The bottom panel of the Explorer editor includes an Environment Variables tab. Here, you can provide sensitive information that you can then include in header values or [preflight scripts](#preflight-scripts-beta). This enables you to share operations (including headers) with other team members _without_ exposing sensitive data.
55
+
The bottom panel of the Explorer editor includes an Environment Variables tab. Here, you can provide sensitive information that you can then include in header values or [preflight scripts](#preflight-scripts). This enables you to share operations (including headers) with other team members _without_ exposing sensitive data.
56
56
57
57
For example, you can define a `token` environment variable like so:
58
58
@@ -101,6 +101,76 @@ To create a preflight script:
101
101
102
102
You're done! After you save your script, it's automatically loaded for any team member that uses the Explorer with the associated variant.
103
103
104
+
#### Preflight script API reference
105
+
106
+
These functions are available within the scope of a preflight script. Snippets for each are available via the **Show snippets** link in the preflight script dialog.
107
+
108
+
<tableclass="field-table api-ref">
109
+
<thead>
110
+
<tr>
111
+
<th>Name /<br/>Type</th>
112
+
<th>Description</th>
113
+
</tr>
114
+
</thead>
115
+
116
+
<tbody>
117
+
118
+
<tr>
119
+
<td>
120
+
121
+
##### `explorer.environment.get`
122
+
123
+
`(key: string) => Readonly`
124
+
</td>
125
+
<td>
126
+
127
+
Function that returns the current value of the environment variable with the specified `key`.
128
+
</td>
129
+
</tr>
130
+
131
+
<tr>
132
+
<td>
133
+
134
+
##### `explorer.environment.set`
135
+
136
+
`(key: string, value: JSONValue) => void`
137
+
</td>
138
+
<td>
139
+
140
+
Function that sets a new value for the environment variable with the specified `key`.
Function that prompts the user for input and returns the value in a promise. If the user cancels the prompt, the promise resolves to `null`.
167
+
</td>
168
+
</tr>
169
+
170
+
</tbody>
171
+
</table>
172
+
173
+
104
174
#### Disabling preflight scripts
105
175
106
176
By default, a variant's preflight script runs automatically before every GraphQL operation that's executed in the Explorer. Team members can temporarily disable the script from the **Preflight script** section of the Settings tab. To do so, toggle the switch to **OFF**:
0 commit comments