Docs

Authorization added

SSE event emitted when a user grants your application an authorization for a tenant

event: AUTHORIZATION_ADDED

Emitted when a user grants your application an authorization for a tenant. Use it as the server-side counterpart to the OAuth consent redirect, so that long-lived backends can react to new authorizations without parsing the redirect URL on the user-facing side.

An authorization is uniquely identified by the triple (tenant_id, application_id, scope). The application_id is implicit from the authenticated subscription on the SSE connection; tenant_id and scope are explicit on the event. At present, the only scope in use is endpoints:manage. Additional scopes may be introduced in future revisions; if so, treat authorizations with different scopes as distinct, even when tenant_id matches.

Data fields

FieldTypeRequiredDescription
event_typestring (AUTHORIZATION_ADDED)yesDiscriminator; matches the event: line.
tenantTenantInfoyesThe tenant for which the authorization was added, with its currently visible endpoints.
scopestringyesThe OAuth scope granted. Today the only value in use is endpoints:manage.
statestringnoEchoes the state you supplied on the authorization request, so your backend can correlate this event with the customer that started the flow. Absent when no state was supplied.

tenant.endpoints follows the same privacy rule as elsewhere in the API: until your application has at least one of its own endpoints in this tenant, the array is empty even if other endpoints exist there.

Because state is echoed both on the consent redirect and on this event, a backend that never sees the redirect can still map the authorization to the customer it belongs to. Treat it as opaque: agrirouter stores and returns it unchanged, and never interprets it.

Sample frame

event: AUTHORIZATION_ADDED
data: {"event_type":"AUTHORIZATION_ADDED","tenant":{"tenant_id":"12345678-abcd-ef01-2345-6789abcdef01","endpoints":[]},"scope":"endpoints:manage","state":"c3RhdGUtZnJvbS15b3VyLWFwcA"}

See also

On this page