# Automatically Authenticate with Preflight Scripts in Apollo Studio Explorer

DevFeed: [Automatically Authenticate with Preflight Scripts in Apollo Studio Explorer](<https://devfeed.tech/articles/automatically-authenticate-with-preflight-scripts-in-apollo-studio-explorer-23232.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/automatically-authenticate-with-preflight-scripts-in-apollo-studio-explorer>)

Author: Parul Schroff

Published: 2022-01-12T08:36:16Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [Script](<https://devfeed.tech/topics/script.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>), [OAuth](<https://devfeed.tech/topics/oauth.md>), [Code](<https://devfeed.tech/topics/code.md>), [Environment Variables](<https://devfeed.tech/topics/environment-variables.md>)

Tags: [announcement](<https://devfeed.tech/tags/announcement.md>), [apollo](<https://devfeed.tech/tags/apollo.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [environment-variables](<https://devfeed.tech/tags/environment-variables.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [oauth](<https://devfeed.tech/tags/oauth.md>), [script](<https://devfeed.tech/tags/script.md>)

## AI overview

This tutorial explains how to use Apollo Studio Explorer Preflight Scripts to run custom authentication before GraphQL operations. It covers configuring scripts for a graph variant, testing and publishing them, using environment variables, and refreshing OAuth access tokens.

## Source excerpt

We recently introduced Preflight Scripts to Explorer! With preflight scripts you can automatically run any custom authentication before your GraphQL operation is executed. Preflight scripts are especially useful for managing authentication flows like OAuth by refreshing an access token, for example. Let's take a look. Setting up your preflight script For a graph and variant you want to create a script for, scroll down to find the "Preflight script" section in Apollo Studio Explorer Settings.