Skip to main content

Authentication

How Sparky handles credentials and token management.

Sparky supports multiple authentication strategies to connect with different types of APIs. All credentials are stored securely in the OS keychain (Keychain on macOS, DPAPI on Windows). Nothing is saved in plain text.

Auth Strategies

StrategyUse CaseExample
bearerAPI token in Authorization headerGitHub, Todoist
oauthOAuth 2.0 PKCE flow with automatic token refreshGmail, Google APIs
botBot token in Authorization headerTelegram bots
urlToken embedded in URL pathAPIs with token-in-URL patterns
basicUsername and passwordBasic auth APIs
headerCustom header name and valueAPIs with non-standard auth headers
queryToken as query parameterAPIs using ?api_key=...

Token Management

For OAuth connections, Sparky handles the entire flow automatically:

  • Opens the authorization page in your browser
  • Captures the callback with the authorization code
  • Exchanges the code for access and refresh tokens
  • Stores tokens securely in the OS keychain
  • Refreshes tokens automatically when they expire

You connect once and it works. No manual token rotation needed.

Credential Storage

All secrets are stored in the native OS keychain. Credentials are never written to disk in plain text. They are scoped per service (e.g. svc.github.TOKEN, svc.gmail.REFRESH_TOKEN).

Stored in Keychain Access using keytar, which natively integrates with the macOS security framework. Each credential is a keychain item scoped to the Sparky application.