Uses: Python · TypeScript · CLI · REST API
cURL samples assume
BASE=https://api.engini.io/v1 and AUTH="x-api-key: $ENGINI_API_KEY" - the setup from the REST walkthrough.1. Find the OAuth method
Each application exposes one or more authentication methods. Prefer the one flaggedisDefault - exactly one method is marked default, and it’s the one used when a connection-create request omits authenticationId - rather than picking “the first one with requiresOAuthSignIn”. Methods also carry a description and, when set, a helpUrl (a per-method install-guide link); show both if you’re building your own picker.
2. Get a sign-in URL
signInUrl (redirect, popup, or new tab). Keep the state - it’s how you collect the result. Store it against the user’s session.
3. Poll until they finish
Engini captures the provider’s callback for you. Poll with thestate until the status reads signed_in. The poll never returns the provider’s token - the server keeps it and derives the connection’s credentials itself.
4. Create the connection
Pass the sign-in’sstate as oauthState - the server looks up its own record of the sign-in and derives the connection’s credentials itself.
Requires
engini / @engini/sdk / @engini/cli 0.21.0 or newer (0.20.0 and earlier cannot create OAuth2 connections).connectionId entirely and still resolve. Without one - and with more than one connection for that app - execution fails with 409 NO_DEFAULT_CONNECTION.
Doing it without writing any of this
The CLI implements this whole flow, including the agent-resumable variant:Next
- Databases and similar apps need object selection after connecting
- Non-OAuth apps skip steps 2-3 entirely - see REST walkthrough