CompleteConnectorOAuth finishes an OAuth connection: it exchanges the…
CompleteConnectorOAuth finishes an OAuth connection: it exchanges the provider's code for a token, seals that token in KMS, and records the connection.
GET /v1/knowledge/connectors/{provider}/callback
| Address | https://api.hanzo.ai/v1/knowledge/connectors/{provider}/callback |
| Method | GET |
| Operation | get_knowledge_connectors_by_provider_callback |
| Auth | Authorization: Bearer $HANZO_API_KEY |
CompleteConnectorOAuth finishes an OAuth connection: it exchanges the provider's code for a token, seals that token in KMS, and records the connection. THE ORG COMES FROM THE SIGNED STATE, not from a header and not from the provider, so an attacker cannot bind their own account to someone else's org — a tampered, expired or foreign-provider state is refused outright. The token itself is never returned, never written into the document, and never logged; the document holds only its KMS path.
Request
4 fields.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
provider | path | string | yes | Provider is the connector completing its flow, from the path. |
code | query | string | — | Code is the provider's authorization code, exchanged for a token. |
state | query | string | — | State is the org-bound value this server signed at connect time. |
error | query | string | — | Error is the provider's denial reason when the user refused consent. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | connectionOut | ok |
200 body — 3 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
account | body | string | — | Account names the connected external account, when the provider reports one. |
provider | body | string | — | Provider is the connector this answer is about. |
status | body | string | — | Status is the connection state: connected or disconnected. |
Failure carries the platform error shape — see Errors.
Examples
hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.
import { Configuration, KnowledgeApi } from 'hanzoai';
const api = new KnowledgeApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getKnowledgeConnectorsByProviderCallback({ provider: 'provider' });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import KnowledgeApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = KnowledgeApi(client).get_knowledge_connectors_by_provider_callback(provider='provider')cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.KnowledgeAPI.GetKnowledgeConnectorsByProviderCallback(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, knowledge_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = knowledge_api::get_knowledge_connectors_by_provider_callback(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.KnowledgeApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new KnowledgeApi(client).getKnowledgeConnectorsByProviderCallback();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl https://api.hanzo.ai/v1/knowledge/connectors/<provider>/callback \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches knowledge through the knowledge tool, which names its 9 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_kb_connectors"
}
}
}'How is this guide?