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).

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.
typescript
Copied
1
import airplane from "airplane";
2
3
export default airplane.task(
4
{
5
slug: "generate_oidc_token",
6
},
7
async (params) => {
8
const token = await airplane.auth.idToken("https://your-app.example.com");
9
10
// Attach the token as a header when calling your API.
11
fetch("https://your-app.example.com/endpoint", {
12
method: "POST",
13
headers: { Authorization: `Bearer ${token}` },
14
});
15
},
16
);
airplane.auth.idToken(audience)
audience
REQUIRED
string

The audience which identifies the intended recipient of the token.

Returns
Promise<string>

The ID token