Moodle REST API 响应中的 privatetoken 有什么用?
what is the use privatetoken in Moodle REST API response?
我正在使用 Moodle 核心 REST API 并且我正在关注 对我的登录请求的回答。登录端点运行成功。
API请求
$ curl -d username="fmcorz" -d password="$PASSWORD" 'https://moodle.org/login/token.php?service=moodle_mobile_app'
回应
{
"token":"SNIPTOKEN",
"privatetoken":"SNIPPRIVATE"
}
我正在使用令牌获取用户 ID 和其他内容。但是我想知道privatetoken的主要用途是什么?
根据我的理解,如果 moodle 安装在 Https 上,这将使用,而当我们使用 http[=31= 时,我们将使用 "token" ] 但不确定,因为我只有 http 基于服务器
请帮助理解这一点,以便我可以选择最佳可用令牌来实施 Moodle REST API。
谢谢。
根据令牌 docs, privatetoken
is only sent when the token is first created and should be saved by the client. The source says it's only sent when the connection is https and the user is not an admin. So I assume it's an edge thing as it should be returned only in very special circumstances. It sounds like it's the Random all-time valid token 只能通过 https 发送,管理员用户无法发送。
我正在使用 Moodle 核心 REST API 并且我正在关注
API请求
$ curl -d username="fmcorz" -d password="$PASSWORD" 'https://moodle.org/login/token.php?service=moodle_mobile_app'
回应
{
"token":"SNIPTOKEN",
"privatetoken":"SNIPPRIVATE"
}
我正在使用令牌获取用户 ID 和其他内容。但是我想知道privatetoken的主要用途是什么?
根据我的理解,如果 moodle 安装在 Https 上,这将使用,而当我们使用 http[=31= 时,我们将使用 "token" ] 但不确定,因为我只有 http 基于服务器
请帮助理解这一点,以便我可以选择最佳可用令牌来实施 Moodle REST API。
谢谢。
根据令牌 docs, privatetoken
is only sent when the token is first created and should be saved by the client. The source says it's only sent when the connection is https and the user is not an admin. So I assume it's an edge thing as it should be returned only in very special circumstances. It sounds like it's the Random all-time valid token 只能通过 https 发送,管理员用户无法发送。