Integration OAuth
The developer authorizes the Integration on their own behalf. The SDK provides a built-in redirect listener — no separate OAuth server required for local development.
Primary flow: authorize()
tokens = await sdk.integration.aauthorize(
open_browser=True,
timeout=300,
)
This uses the default Integration scopes (spark:all, spark:applications_token, application:webhooks_write, application:webhooks_read). Override with scopes=[...] if needed.
This will:
- Build the authorization URL
- Start a temporary HTTP server on
redirect_uri - Open the system browser (optional)
- Capture
?code=from the redirect - Exchange the code and store tokens
Manual / CI flow
url, state = sdk.integration.get_authorization_url(scopes=[...])
# Complete OAuth in browser, then:
tokens = await sdk.integration.aexchange_code(code)
Redirect URI requirements
- Must be registered on your Integration in the Developer Portal
http://127.0.0.1:8765/callbackworks for local development- Production integrations may use HTTPS callbacks on your own server; use
exchange_code()if you handle the redirect externally
Token refresh
token = await sdk.integration.aget_access_token() # auto-refreshes if expired