这个方法用户登录API和获取一个认证票据。
当使用这个方法的时候, 你必须使用 方法,防止产生大量的开放会话记录。.
Description
string/object user.login(object **parameters**)
This method allows to log in to the API and generate an authentication token.
When using this method, you also need to do user.logout to prevent the generation of a large number of open session records.
参数
这种方法对于未经身份验证的用户是可用的,并且必须在JSON-RPC请求中没有auth
数调用。
(object)
包含用户名和密码的参数。
该方法接受以下参数。
当使用HTTP认证时,API请求中的用户名必须与授权
头中使用的名称相匹配。密码将不会被验证,并且可以省略。
(object)
Parameters containing the user name and password.
The method accepts the following parameters.
When using HTTP authentication, the user name in the API request must match the one used in the Authorization
header. The password will not be validated and can be omitted.
返回值
如果使用userDat
参数,则返回包含关于经过身份验证用户信息的对象。
关于, 返回以下信息:
如果一个用户在一次或多次失败的尝试之后成功地进行了身份验证,该方法将返回attempt_clock
、尝试失败
和尝试ip
属性的当前值,然后重新设置它们。
如果不使用userData
参数,该方法将返回身份验证令牌。
所生成的认证令牌必须存储,并在以下JSON-RPC请求的auth
参数中使用。在使用HTTP认证时也需要它。
Return values
If the userData
parameter is used, returns an object containing information about the authenticated user.
If a user has been successfully authenticated after one or more failed attempts, the method will return the current values for the attempt_clock
, attempt_failed
and attempt_ip
properties and then reset them.
If the userData
parameter is not used, the method returns an authentication token.
The generated authentication token should be remembered and used in the auth
parameter of the following JSON-RPC requests. It is also required when using HTTP authentication.
Examples
认证一个用户
Authenticating a user
认证一个用户
Request:
Response:
Requesting authenticated user’s information
Authenticate and return additional information about the user.
Request:
Response: