Skip to content

Commit 1310d97

Browse files
committed
Combine the steps
1 parent 8762b22 commit 1310d97

File tree

2 files changed

+27
-71
lines changed

2 files changed

+27
-71
lines changed

en_US/dashboard/introduction.md

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,9 @@ This feature is particularly useful for seamless redirection and integration sce
5454

5555
#### How To Use This Login Method
5656

57-
1. Call the `/login` API to obtain the login token and related information.
57+
1. Use the `/login` endpoint to obtain an authentication token. Since the response does not include the username, you will need to manually add it before encoding the full JSON payload.
5858

59-
```
60-
curl -X POST "http://127.0.0.1:18083/api/v5/login" \
61-
-H 'accept: application/json' \
62-
-H 'Content-Type: application/json' \
63-
-d '{"username": "admin","password": "public"}'
64-
{"license":{"edition":"ee"},"role":"administrator","token":"xxx.yyy.zzz","version":"5.6.1"}
65-
```
66-
67-
2. Combine the data into a JSON structure. Manually add the username used during login (not included in the `/login` response).
68-
69-
```json
70-
{
71-
"license": {
72-
"edition": "ee"
73-
},
74-
"role": "administrator",
75-
"token": "xxx.jwt.token",
76-
"version": "5.6.1-g0fef19f8",
77-
"username": "admin"
78-
}
79-
```
80-
81-
3. Convert the JSON string to Base64. Below is an example on how to get base64-encoded authentication string in one call:
59+
You can perform all steps, including requesting the token, injecting the username, and encoding the result in Base64, in a single command, as shown below:
8260

8361
```
8462
curl -s -X POST "http://127.0.0.1:18083/api/v5/login" \
@@ -87,23 +65,23 @@ This feature is particularly useful for seamless redirection and integration sce
8765
-d '{"username": "admin","password": "public"}' | jq '.username = "admin"' | base64
8866
```
8967

90-
4. Embed the encoded string in the `login_meta` query parameter of the Dashboard URL.
68+
2. Construct the login URL. Embed the encoded string in the `login_meta` query parameter of the Dashboard URL. For example:
9169

92-
#### Example URL
70+
For EMQX versions **before 5.6.0**:
9371

94-
For versions **before 5.6.0**:
72+
```bash
73+
http://localhost:18083?login_meta=BASE64_ENCODED_STRING
74+
```
9575

96-
```bash
97-
http://localhost:18083?login_meta=BASE64_ENCODED_STRING
98-
```
76+
This redirects to the default cluster overview page.
9977

100-
Redirects to the default cluster overview page.
78+
For EMQX **version 5.6.0 and later**:
10179

102-
For **version 5.6.0 and later**, you can also specify a target page:
80+
```bash
81+
http://localhost:18083/#/dashboard/overview?login_meta=BASE64_ENCODED_STRING
82+
```
10383

104-
```bash
105-
http://localhost:18083/#/dashboard/overview?login_meta=BASE64_ENCODED_STRING
106-
```
84+
This allows specifying the target page after login.
10785

10886
This method provides a smooth, pre-authenticated user experience for accessing the EMQX Dashboard. Make sure to handle the token securely and ensure it has appropriate expiration and scope limits.
10987

zh_CN/dashboard/introduction.md

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,9 @@ EMQX Dashboard 是一个 Web 应用程序,默认监听 `18083` 端口。下载
5656

5757
使用此登录方式的步骤如下:
5858

59-
1. 调用 `/login` 接口,获取登录返回的 token 及相关信息
59+
1. 使用 `/login` 接口获取身份验证 token。由于返回结果中不包含用户名,你需要手动将用户名添加到 JSON 数据中,再进行编码
6060

61-
```
62-
curl -X POST "http://127.0.0.1:18083/api/v5/login" \
63-
-H 'accept: application/json' \
64-
-H 'Content-Type: application/json' \
65-
-d '{"username": "admin","password": "public"}'
66-
{"license":{"edition":"ee"},"role":"administrator","token":"xxx.yyy.zzz","version":"5.6.1"}
67-
```
68-
69-
2. 将数据整理成如下 JSON 结构,手动添加登录时使用的用户名(该字段不包含在接口返回中)。
70-
71-
```json
72-
{
73-
"license": {
74-
"edition": "ee"
75-
},
76-
"role": "administrator",
77-
"token": "xxx.jwt.token",
78-
"version": "5.5.0-g0fef19f8",
79-
"username": "admin"
80-
}
81-
```
82-
83-
3. 将 JSON 字符串进行 Base64 编码。
61+
你可以通过以下命令一步完成所有操作,包括请求 token、添加用户名,以及将结果进行 Base64 编码:
8462

8563
```
8664
curl -s -X POST "http://127.0.0.1:18083/api/v5/login" \
@@ -89,25 +67,25 @@ EMQX Dashboard 是一个 Web 应用程序,默认监听 `18083` 端口。下载
8967
-d '{"username": "admin","password": "public"}' | jq '.username = "admin"' | base64
9068
```
9169

92-
4. 将编码后的字符串通过 `login_meta` 参数附加到 Dashboard 的访问 URL 中。
70+
2. 构造登录 URL。将编码后的字符串嵌入到 Dashboard URL `login_meta` 查询参数中。例如:
9371

94-
#### 示例 URL
72+
对于 **EMQX 5.6.0 之前的版本**
9573

96-
**5.6.0 以下版本**
74+
```bash
75+
http://localhost:18083?login_meta=BASE64_ENCODED_STRING
76+
```
9777

98-
```bash
99-
http://localhost:18083?login_meta=BASE64_ENCODED_STRING
100-
```
78+
该方式会跳转至默认的集群概览页面。
10179

102-
将默认跳转至集群总览页面。
80+
对于 **EMQX 5.6.0 及以上版本**
10381

104-
**5.6.0 及以上版本**,可指定跳转页面:
82+
```bash
83+
http://localhost:18083/#/dashboard/overview?login_meta=BASE64_ENCODED_STRING
84+
```
10585

106-
```bash
107-
http://localhost:18083/#/dashboard/overview?login_meta=BASE64_ENCODED_STRING
108-
```
86+
该方式支持在登录后跳转到指定页面。
10987

110-
通过该方式,可以为用户提供无需手动登录的便捷访问体验。请确保妥善管理 token 的安全性,建议设置合理的过期时间和访问权限范围。
88+
通过这种登录方式,可以为用户提供无需手动登录的便捷访问体验。请确保妥善管理 token 的安全性,建议设置合理的过期时间和访问权限范围。
11189

11290
## 忘记密码
11391

0 commit comments

Comments
 (0)