OIDC Trusted Workloads
Authenticate backend services to Strave Public API v2 with short-lived OIDC tokens instead of static API keys.
Static API keys can leak and stay valid until revoked. Strave recommends OIDC Trusted Workloads for every production backend, and strictly requires short-lived OIDC/OAuth 2.1 JWT access tokens on sensitive routes such as 2D replay viewer session minting.
1. Register your workload in the Developer Portal
- Open your organisation's Application in Strave.
- Go to Credentials and select Add workload.
- Pick your provider (Vercel, GitHub Actions, GitLab CI, or Google Cloud) and enter your project, repository, or service account claim values.
- Keep the audience
https://strave.gg/api/auth.
2. Configure @strave/sdk with oidcWorkload
@strave/sdk exchanges your platform OIDC JWT via RFC 7523 (jwt-bearer),
caches the resulting 15-minute Strave JWT access token in memory, and refreshes
it automatically before expiry:
import { createStraveClient } from "@strave/sdk";
import { getVercelOidcToken } from "@vercel/oidc";
export const strave = createStraveClient({
oidcWorkload: {
clientId: process.env.STRAVE_CLIENT_ID!,
getAssertion: () =>
getVercelOidcToken({ audience: "https://strave.gg/api/auth" }),
scopes: ["event:read", "broadcast:manage"],
},
});3. Use with Effect v4
Pass the same oidcWorkload config into StraveClient.layer:
import { StraveClient } from "@strave/sdk/effect";
import { getVercelOidcToken } from "@vercel/oidc";
import { Effect } from "effect";
const StraveLive = StraveClient.layer({
oidcWorkload: {
clientId: process.env.STRAVE_CLIENT_ID!,
getAssertion: () =>
getVercelOidcToken({ audience: "https://strave.gg/api/auth" }),
scopes: ["event:read"],
},
});
const program = Effect.gen(function* () {
const strave = yield* StraveClient;
return yield* strave.events.get("event_01K4ZK");
}).pipe(Effect.provide(StraveLive));When static API keys are rejected
High-security routes such as
POST /api/v2/replays/{matchId}/{mapIndex}/viewer-sessions verify tokens with
strict JWKS JWT validation and reject strave_sk_ API keys with 401 invalid_token. Use oidcWorkload or an OAuth 2.1 flow for these routes.