Hosted form credential submit (page cookie + CSRF)
Persists credentials entered on the hosted form (for an oauth2 auth declaring connect.login, the grant they render is sent to the token endpoint first) — or, for another oauth2 auth (reached only when the integration declares connection variables), starts its OAuth flow with the submitted variables and returns the provider URL to navigate to; the connection is then created by the callback. Context + actor come from the page cookie; the request carries only the credentials and/or the variables and echoes the CSRF nonce in the x-connect-csrf header. An oauth2 refusal mirrors startIntegrationConnect: a variable to fix is a 400 validation_failed and the form can be resubmitted; another refusal keeps its status with a generic detail, and keeps the page session only when it preceded any request to the authorization server; anything else is a 502 that ends the session. An oauth2 connect.login submission is single-use: the page session is spent before the token request, so a concurrent or repeated submission is a 404 and a grant is presented once. A refusal before the grant leaves the platform (an invalid submission, no usable or an unsupported OAuth client, an issuer binding refusal, a token endpoint the egress guard refuses) hands the session back and the form can be submitted again; once the token request may have been sent, any outcome ends it. A refusal that ends the page session carries the RFC 9457 extension member connect_session_ended: true, whatever its status: the form must not be offered again, since a resubmission is a 404 that reaches no service.
/api/integrations/connect/submitCookie session from Better Auth. Requires X-Org-Id header for org-scoped routes.
In: cookie
Header Parameters
Double-submit CSRF nonce (from GET /connect/context).
Request Body
application/json
curl -X POST "https://your-instance/api/integrations/connect/submit" \ -H "x-connect-csrf: string" \ -H "Content-Type: application/json" \ -d '{}'{
"ok": true,
"connection": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"integration_package_id": "string",
"auth_key": "string",
"account_id": "string",
"identity_claims": {},
"scopes_granted": [
"string"
],
"needs_reconnection": true,
"expiresAt": "2019-08-24T14:15:22Z",
"owner_type": "user",
"owner_id": "string",
"owner_name": "string",
"locked_by": "admin_pin",
"label": "string",
"scope": "org",
"spaceId": "string",
"shared_here": true,
"shared_space_ids": [
"string"
],
"share_all_spaces": true,
"origin_space_id": "string",
"allowed_actions": [
"rename"
],
"shareable_spaces": [
{
"id": "string",
"name": "string"
}
],
"client_ref": "string",
"variables": {
"property1": "string",
"property2": "string"
},
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
},
"redirect_url": "http://example.com",
"handoff_steps": [
{
"kind": "command",
"id": "string",
"label": "string",
"shell": "string",
"note": "string",
"deferred": true
}
]
}{
"type": "https://docs.appstrate.dev/errors/validation-failed",
"title": "Validation Failed",
"status": 400,
"detail": "name: Invalid input: expected string, received undefined (+2 more)",
"code": "validation_failed",
"request_id": "req_abc123",
"errors": [
{
"field": "name",
"code": "required",
"message": "Invalid input: expected string, received undefined"
},
{
"field": "email",
"code": "invalid_format",
"message": "Invalid email address"
},
{
"field": "age",
"code": "invalid_type",
"message": "Invalid input: expected number, received string"
}
]
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"param": "string",
"retry_after": 0,
"errors": [
{
"field": "string",
"code": "string",
"message": "string",
"title": "string",
"line": 1,
"column": 1,
"candidate_connections": [
{
"id": "string",
"label": "string",
"account_id": "string",
"owned_by_actor": true,
"needs_reconnection": true,
"scopes_granted": [
"string"
],
"missing_scopes": [
"string"
]
}
],
"connection_id": "string",
"missing_scopes": [
"string"
],
"remedy": "new_connection",
"owned_by_actor": true,
"required_scopes": [
"string"
],
"auth_key": "string",
"required_auth_key": "string",
"available_auth_keys": [
"string"
],
"source": "admin_pin",
"connect_url": "http://example.com",
"expiresAt": "2019-08-24T14:15:22Z",
"packageId": "string"
}
],
"grant_may_be_redeemed": true,
"connect_session_ended": true
}{
"type": "https://docs.appstrate.dev/errors/not-found",
"title": "Not Found",
"status": 404,
"detail": "Resource not found",
"code": "not_found",
"request_id": "req_abc123"
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"param": "string",
"retry_after": 0,
"errors": [
{
"field": "string",
"code": "string",
"message": "string",
"title": "string",
"line": 1,
"column": 1,
"candidate_connections": [
{
"id": "string",
"label": "string",
"account_id": "string",
"owned_by_actor": true,
"needs_reconnection": true,
"scopes_granted": [
"string"
],
"missing_scopes": [
"string"
]
}
],
"connection_id": "string",
"missing_scopes": [
"string"
],
"remedy": "new_connection",
"owned_by_actor": true,
"required_scopes": [
"string"
],
"auth_key": "string",
"required_auth_key": "string",
"available_auth_keys": [
"string"
],
"source": "admin_pin",
"connect_url": "http://example.com",
"expiresAt": "2019-08-24T14:15:22Z",
"packageId": "string"
}
]
}{
"type": "https://docs.appstrate.dev/errors/rate-limited",
"title": "Rate Limited",
"status": 429,
"detail": "Too many requests. Please try again shortly.",
"code": "rate_limited",
"request_id": "req_abc123",
"retry_after": 30
}{
"type": "http://example.com",
"title": "string",
"status": 0,
"detail": "string",
"instance": "string",
"code": "string",
"request_id": "string",
"param": "string",
"retry_after": 0,
"errors": [
{
"field": "string",
"code": "string",
"message": "string",
"title": "string",
"line": 1,
"column": 1,
"candidate_connections": [
{
"id": "string",
"label": "string",
"account_id": "string",
"owned_by_actor": true,
"needs_reconnection": true,
"scopes_granted": [
"string"
],
"missing_scopes": [
"string"
]
}
],
"connection_id": "string",
"missing_scopes": [
"string"
],
"remedy": "new_connection",
"owned_by_actor": true,
"required_scopes": [
"string"
],
"auth_key": "string",
"required_auth_key": "string",
"available_auth_keys": [
"string"
],
"source": "admin_pin",
"connect_url": "http://example.com",
"expiresAt": "2019-08-24T14:15:22Z",
"packageId": "string"
}
],
"grant_may_be_redeemed": true,
"connect_session_ended": true
}{
"type": "https://docs.appstrate.dev/errors/connect-unavailable",
"title": "Service Unavailable",
"status": 503,
"detail": "This connection method is unavailable on this deployment. Contact your administrator.",
"code": "connect_unavailable",
"request_id": "req_abc123"
}{
"type": "https://docs.appstrate.dev/errors/timeout",
"title": "Gateway Timeout",
"status": 504,
"detail": "The connection attempt timed out after 60000ms — the login did not complete in time. Please try again.",
"code": "timeout",
"request_id": "req_def456"
}