bling.oauth-callback ​
Validates the OAuth state, exchanges the authorization code for access/refresh tokens at Bling, and delegates persistence to connection.setup.
Finalize a Bling OAuth connection from the redirect callback.
Overview ​
| Property | Value |
|---|---|
| Workflow type | Linear |
| Library | App-bling |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | Organization the OAuth flow was started for |
code | string | Yes | — | Authorization code Bling returned to the callback |
state | string | Yes | — | Signed state token issued by bling.oauth-start |
actor | string | No | — | Caller identity (defaults to context.actor) |
connection_name | string | No | — | Override connection_name; otherwise taken from state |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | Organization the OAuth flow was started for |
code | string | Yes | — | Authorization code Bling returned to the callback |
state | string | Yes | — | Signed state token issued by bling.oauth-start |
actor | string | No | — | Caller identity (defaults to context.actor) |
connection_name | string | No | — | Override connection_name; otherwise taken from state |
redirect_uri | string | No | — | Redirect URI verified from the state token |
access_token | string | No | — | Bling access_token from code exchange |
refresh_token | string | No | — | Bling refresh_token from code exchange |
expires_at | string | No | — | ISO-8601 expiry of the access_token |
scope | string | No | — | OAuth scope returned by Bling |
connection_uuid | uuid | No | — | UUID of the CloudConnection row produced by connection.setup |
state_verified_at | string | No | — | ISO-8601 timestamp the state token was accepted |
tokens_exchanged_at | string | No | — | ISO-8601 timestamp the code was exchanged |
completed_at | string | No | — | ISO-8601 timestamp of overall completion |
failure_reason | string | No | — | Why this run failed (on the failed branch) |
failed_at | string | No | — | ISO-8601 timestamp of failure |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | json | No | — | — |
failed_layer | json | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
initiated | Yes | No | — | verify_state | Callback received |
delegating_setup | No | No | — | complete | Persisting via connection.setup |
exchanging_code | No | No | — | delegate_setup | Trading the authorization code for tokens at Bling |
verifying_state | No | No | — | exchange_code | Verifying signed state token |
completed | No | Yes | Yes | — | Bling connection ready |
failed | No | Yes | No | — | Bling OAuth callback failed |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
initiated | verify_state | verifying_state | — |
verifying_state | exchange_code | exchanging_code | — |
exchanging_code | delegate_setup | delegating_setup | — |
delegating_setup | complete | completed | — |
initiated | fail | failed | — |
verifying_state | fail | failed | — |
exchanging_code | fail | failed | — |
delegating_setup | fail | failed | — |
Business Errors ​
| Code | Message Template |
|---|---|
BLING_INVALID_STATE | Invalid or expired Bling OAuth state token: |
BLING_STATE_ORG_MISMATCH | OAuth state was issued for a different organization |
BLING_CODE_EXCHANGE_FAILED | Bling refused the authorization code: |
BLING_SETUP_DELEGATION_FAILED | connection.setup failed for Bling: |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "bling.oauth-callback",
"initial_data": {
"organization_uuid": "value",
"code": "value",
"state": "value"
}
}