用户验证
用户验证
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
请求参数
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | none |
» grant_type | body | string | false | 填固定值 client_credentials。 |
» client_id | body | string | false | 应用的 client_id。可参考 应用管理页面 > 选定指定应用 > 单击应用配置 > 对应的“Client Id”。 |
» client_secret | body | string | false | 应用的 client_secret 。可参考 应用管理页面 > 选定指定应用 > 单击应用配置 > 对应的“client_secret”。 |
» scope | body | string | true | 申请授权的 scope,多个 scope 之间使用空格分隔。 |
响应示例
200 Response
{
"access_token": "string",
"expires_in": 0,
"token_type": "string",
"scope": "string"
}
响应
状态 | 含义 | 描述 | Schema |
---|---|---|---|
200 | OK | none | AccessToken |
获取用户信息
代码示例
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 |
---|---|---|---|
200 | OK | none | UserInfo |
数据类型
AccessToken
{
"access_token": "string",
"expires_in": 0,
"token_type": "string",
"scope": "string"
}
属性
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
access_token | string | true | none | 返回的access token (JWT) |
expires_in | number | true | none | token的有效期,单位:秒 |
token_type | string | true | none | Token 类型,目前返回的是固定值 Bearer。 |
scope | string | false | none | Access Token 的 Scope。 |
UserInfo
{
"sub": "string",
"userName": "string",
"name": "string",
"phoneNumber": "string",
"email": "string",
"gender": "string",
"address": null
}
属性
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
sub | string | false | none | 用户唯一标识。 |
userName | string | false | none | 用户注册用户名。 |
name | string | false | none | 用户姓名。 |
phoneNumber | string | false | none | 用户电话号码。 |
string | false | none | 用户邮箱地址。 | |
gender | string | false | none | 用户性别, female 代表女性, male 代表男性。 |
address | any | false | none | 地址 |
Loading...