用户验证


用户验证

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

RESTful 登录接口参考文档。

Base URLs:

Authentication

  • HTTP Authentication, scheme: bearer

用户授权

获取客户端凭证

代码示例

POST https://iam.ticos.cc/oauth2/token HTTP/1.1
Host: iam.ticos.cc
Content-Type: application/x-www-form-urlencoded
Accept: application/json

POST /oauth2/token

通过授权来获取access token或者refresh token,主要用于不需要用户交互的场景,如后端服务。

请求参数

grant_type: string
client_id: string
client_secret: string
scope: string

请求参数

NameInTypeRequiredDescription
bodybodyobjecttruenone
» grant_typebodystringfalse填固定值 client_credentials。
» client_idbodystringfalse应用的 client_id。可参考 应用管理页面 > 选定指定应用 > 单击应用配置 > 对应的“Client Id”。
» client_secretbodystringfalse应用的 client_secret 。可参考 应用管理页面 > 选定指定应用 > 单击应用配置 > 对应的“client_secret”。
» scopebodystringtrue申请授权的 scope,多个 scope 之间使用空格分隔。

响应示例

200 Response

{
  "access_token": "string",
  "expires_in": 0,
  "token_type": "string",
  "scope": "string"
}

响应

状态含义描述Schema
200OKopen in new windownoneAccessToken

获取用户信息

代码示例

GET https://iam.ticos.cc/userinfo HTTP/1.1
Host: iam.ticos.cc
Accept: application/json

GET /userinfo

响应示例

200 Response

{
  "sub": "string",
  "userName": "string",
  "name": "string",
  "phoneNumber": "string",
  "email": "string",
  "gender": "string",
  "address": null
}

响应

状态含义描述Schema
200OKopen in new windownoneUserInfo

数据类型

AccessToken

{
  "access_token": "string",
  "expires_in": 0,
  "token_type": "string",
  "scope": "string"
}

属性

NameTypeRequiredRestrictionsDescription
access_tokenstringtruenone返回的access token (JWT)
expires_innumbertruenonetoken的有效期,单位:秒
token_typestringtruenoneToken 类型,目前返回的是固定值 Bearer。
scopestringfalsenoneAccess Token 的 Scope。

UserInfo

{
  "sub": "string",
  "userName": "string",
  "name": "string",
  "phoneNumber": "string",
  "email": "string",
  "gender": "string",
  "address": null
}

属性

NameTypeRequiredRestrictionsDescription
substringfalsenone用户唯一标识。
userNamestringfalsenone用户注册用户名。
namestringfalsenone用户姓名。
phoneNumberstringfalsenone用户电话号码。
emailstringfalsenone用户邮箱地址。
genderstringfalsenone用户性别, female 代表女性, male 代表男性。
addressanyfalsenone地址
上次编辑于: 2022/12/17 07:45:59
Loading...