Auth (OIDC)
Integrate with Airplane OpenID Connect (OIDC).
Airplane's Auth SDK provides utilities for authenticating with other APIs (such as AWS, GCP, or your
own API).
See Airplane OpenID Connect (OIDC) to learn more.
ID Token
ID Token
Generates a short-lived ID token from Airplane's OpenID Connect provider.
These short-lived ID tokens can be used to "prove" their identity and authenticate with a target API
(such as AWS, GCP, or your own API). ID tokens contain subject and claim information specific to the
task and runner.
typescriptCopied1import airplane from "airplane";23export default airplane.task(4{5slug: "generate_oidc_token",6},7async (params) => {8const token = await airplane.auth.idToken("https://your-app.example.com");910// Attach the token as a header when calling your API.11fetch("https://your-app.example.com/endpoint", {12method: "POST",13headers: { Authorization: `Bearer ${token}` },14});15},16);
airplane.auth.idToken(audience)
audience
REQUIRED
The audience which identifies the intended recipient of the token.
Returns
The ID token
pythonCopied1import airplane2import requests34@airplane.task()5def generate_oidc_token():6token = airplane.auth.id_token("https://your-app.example.com")78# Attach the token as a header when calling your API.9requests.post(10"https://your-app.example.com/endpoint",11headers={"Authorization": f"Bearer {token}"},12)
airplane.auth.id_token(audience)
audience
REQUIRED
The audience which identifies the intended recipient of the token.
Returns
The ID token
Raises
If the ID token could not be created.