NATSoauth.app.create注册应用

注册开放平台应用;生成 clientId 与 clientSecret(secret 仅本次返回,服务端存哈希)。

Request Payload

消息格式:JSON

NameData TypeRequiredDescription
ownerIdstringYes注册人用户 ID
namestringYes应用名称
homepagestringNo应用主页
redirectUrisarrayYes允许的回调地址(https)
tokenTypestringYes访问令牌形态:jwt / opaque(注册后不可变更)
scopesarrayYes申请的 scope 列表
type RequestBody = {
  /** 注册人用户 ID */
  ownerId: string
  /** 应用名称 */
  name: string
  /** 应用主页 */
  homepage?: string
  /** 允许的回调地址(https) */
  redirectUris: string[]
  /** 访问令牌形态:jwt / opaque(注册后不可变更) */
  tokenType: string
  /** 申请的 scope 列表 */
  scopes: string[]
}
{
  "ownerId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
  "name": "Xeegam Analytics",
  "homepage": "https://analytics.xeegam.com",
  "redirectUris": [
    "https://analytics.xeegam.com/oauth/callback"
  ],
  "tokenType": "jwt",
  "scopes": [
    "user:profile:read",
    "orgs:list"
  ]
}

Response Payload

回复使用统一信封 {id, code, messages, result},其 result:

NameData TypeRequiredDescription
appIdstringYes应用 ID
clientIdstringYes客户端标识
clientSecretstringYes客户端密钥(仅此一次完整返回)
statusstringYes固定为 pending
createdAtstringYes注册时间
type ResponseBody = {
  /** 应用 ID */
  appId: string
  /** 客户端标识 */
  clientId: string
  /** 客户端密钥(仅此一次完整返回) */
  clientSecret: string
  /** 固定为 pending */
  status: string
  /** 注册时间 */
  createdAt: string
}
{
  "appId": "01JD8SNST2N5U6X1BU9YBHK4C7J",
  "clientId": "cli_9f2ka81mdx",
  "clientSecret": "cs_5Kx9mQeR2vB8wL7pN3tZ6yH4",
  "status": "pending",
  "createdAt": "2026-10-01T10:00:00Z"
}

Response Code

回复使用统一信封 {id, code, messages, result},其 code 字段:

code Meaning Notes
0 成功 注册应用
2701 回调地址无效
2704 scope 无效

Examples

{
  "ownerId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
  "name": "Xeegam Analytics",
  "homepage": "https://analytics.xeegam.com",
  "redirectUris": ["https://analytics.xeegam.com/oauth/callback"],
  "tokenType": "jwt",
  "scopes": ["user:profile:read", "orgs:list"]
}
{
  "id": "01JD8SWIWH6J3KG",
  "code": 0,
  "messages": [],
  "result": {
    "appId": "01JD8SNST2N5U6X1BU9YBHK4C7J",
    "clientId": "cli_9f2ka81mdx",
    "clientSecret": "cs_5Kx9mQeR2vB8wL7pN3tZ6yH4",
    "status": "pending",
    "createdAt": "2026-10-01T10:00:00Z"
  }
}