Handling OAuth2 tokens is complex. dataflows abstracts this away completely.
connections TableTokens are stored in the connections table.
access_token and refresh_token are encrypted using AES-256-GCM before being written to the database.expires_at and refreshes the token before a workflow step runs.We separate the "Application" (Service Client) from the "User" (Connection).
client_id and client_secret.access_token.Workflows never access secrets directly. They request a fetch instance that is pre-configured with the correct headers.
// ❌ BAD: Handling tokens manually
const token = await db.tokens.find(...)
await fetch('https://api.github.com', { headers: { Authorization: token } })
// ✅ GOOD: Dependency Injection
export async function getIssues(repo: string) {
'use step'
// The engine injects the authenticated fetch client
return github.getIssues(repo, { fetch, apiToken: GITHUB_TOKEN })
}
Each workflow execution runs in an isolated context.