认证 Beta
使用 Veripass 为你的组织签发的 Bearer 令牌认证 API 请求。Webhook 则通过各自的 ingress binding 进行认证。
每个 API 请求都要表明发起者是谁。Sommatic AI 依据这一身份把你能看到的数据限定在所属组织内,并记录每次运行、 每个任务和每项变更是由谁完成的。
携带 Bearer 令牌
在每个请求的 Authorization 请求头中发送令牌:
令牌由 Sommatic AI 的身份权威 Veripass 为你的组织签发,包含你的身份、所属组织和角色,从而让每一项敏感操作都绑定到 具体的执行者和组织。
Shell
curl "https://api.sommatic.ai/work-management/task/inbox?user_id=$USER_IDENTITY&page=1&pageSize=25" \
-H "Authorization: Bearer $SOMMATIC_TOKEN"JavaScript
const response = await fetch('https://api.sommatic.ai/platform-infrastructure/credential/organization-id?search=' + organizationId, {
headers: { Authorization: `Bearer ${token}` },
});JavaScript
import { PlatformInfrastructureCredentialService } from '@sommatic/react-sdk';
const credentials = new PlatformInfrastructureCredentialService({ apiKey: token });
const response = await credentials.getByParameters({ queryselector: 'organization-id', search: organizationId });没有有效令牌的请求会被拒绝,返回 HTTP 401:
JSON
{ "status": 401, "success": false, "message": "Unauthorized", "result": null }Webhook 按 binding 认证
POST /workflow-orchestration/trigger/webhooks/:mode/:bindingIdentifier 是唯一不接收 Bearer 令牌的接口:
调用工作流的外部系统通常没有 Veripass 身份。每个 Webhook 都通过一个 ingress binding 对外暴露,binding 在其
authentication 配置块中声明调用方如何认证:
authentication.mode | binding 的要求 |
|---|---|
api-key | binding 的 allowed_api_keys 中的某个密钥。 |
oauth2 | 具备 binding oauth_scopes 的 OAuth 2 令牌。 |
veripass-session | 按 binding 的 veripass_policy 校验的 Veripass 会话。 |
service-token | 服务令牌。 |
custom | 该集成特有的认证方案。 |
none | 无需认证。仅用于不涉及真实数据的测试 binding。 |
JSON
{
"slug": "ingress.http.inbound-requests",
"ingress_kind": "http",
"mode": "prod",
"authentication": { "mode": "api-key", "allowed_api_keys": ["replace-with-a-long-random-key"] }
}使用触发器分组的接口创建和编辑 binding,这些接口需要 Bearer 令牌。
如何调用 Webhook、它的 test 与 prod 模式以及请求体,详见 Webhook。