11---
2- sidebar_position : 2
3- title : 以secret获取token
2+ sidebar_position : 1
3+ title : 获取管理员token
44hide_title : true
55---
66
77<center >
88
9- ## 以 secret 获取 token
9+ ## 获取管理员 token
1010
1111</center >
1212
1313### 简要描述
1414
15- - 获取用户或 APP 管理员 token。
15+ - 获取 APP 管理员 token。
1616
17- ⚠️ ** 注意** : OpenIM Server 内置了一个 APP 管理员,它的 ` userID ` 是` imAdmin ` :
17+ ⚠️ ** 注意** : OpenIM Server 内置了一个 APP 管理员,它的 ` userID ` 是` imAdmin `
1818
1919### 请求方式
2020
@@ -26,8 +26,8 @@ hide_title: true
2626
2727### Header
2828
29- | header 名 | 示例值 | 选填 | 类型 | 说明 |
30- | :---------- | :------------ | :--- | ------ | ---------------------------- |
29+ | header 名 | 示例值 | 选填 | 类型 | 说明 |
30+ | :---------- | :------------ | :--- | ------ | -------------------------------------------------- |
3131| operationID | 1646445464564 | 必填 | string | 用于全局链路追踪,建议使用时间戳,在每个请求中独立 |
3232
3333### 请求参数示例
@@ -36,15 +36,15 @@ hide_title: true
3636{
3737 "secret" : " openIM123" ,
3838 "platformID" : 1 ,
39- "userID" : " 111111 "
39+ "userID" : " imAdmin "
4040}
4141```
4242
4343| 字段名 | 选填 | 类型 | 说明 |
4444| :--------- | :--- | :----- | ----------------------------------------------------------------------------------------------------------------- |
4545| secret | 必填 | string | openIM 密钥,见 config/share.yaml 中 secret 字段 |
4646| platformID | 必填 | int | 平台 ID, 1:IOS,2:Android,3:Windows,4:OSX,5:Web,6:MiniWeb,7:Linux,8:Android Pad,9:IPad,10:admin |
47- | userID | 必填 | string | 用户 ID 或管理员 ID, 如生成管理员 token, 需填写 ` imAdmin ` |
47+ | userID | 必填 | string | APP 管理员 ID,为 ` imAdmin ` |
4848
4949### 成功返回示例
5050
@@ -65,8 +65,8 @@ hide_title: true
6565| 参数名 | 类型 | 说明 |
6666| :---------------- | :----- | :--------------------------- |
6767| errCode | int | 错误码,0 表示成功 |
68- | errMsg | string | 错误简要信息,为空 |
69- | errDlt | errDlt | 错误详细信息,为空 |
68+ | errMsg | string | 错误简要信息,为空 |
69+ | errDlt | errDlt | 错误详细信息,为空 |
7070| data | object | 通用数据对象,具体结构见下方 |
7171| token | string | 获取到的用户 token |
7272| expireTimeSeconds | string | token 的过期时间(单位秒) |
0 commit comments