[comment]: # ({7063b41c-7063b41c})
# token.update

[comment]: # ({/7063b41c-7063b41c})

[comment]: # ({677d903b-f2679bab})
### 描述

`object token.update(object/array tokens)`

此方法允许update现有令牌.

::: noteclassic
用户角色需具备*管理API令牌* [配置](/manual/web_interface/frontend_sections/users/user_roles#配置)权限才能为其他用户管理令牌.

:::

[comment]: # ({/677d903b-f2679bab})

[comment]: # ({416a8426-416a8426})
### 参数

`(object/array)` 需要更新的令牌属性.

每个令牌必须定义 `tokenid` 属性，其他所有属性均为可选。仅传递的属性会被更新，其余属性将保持不变.

该方法接受具有[standard token properties](object)的令牌.

[comment]: # ({/416a8426-416a8426})

[comment]: # ({d0adc398-d0adc398})
### 返回值

`(object)` 返回一个包含更新令牌ID的object，这些ID位于`tokenids`属性下。

[comment]: # ({/d0adc398-d0adc398})

[comment]: # ({b41637d2-b41637d2})
### 示例

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({63919922-4f041664})
#### 移除令牌过期

移除令牌的过期日期。

请求:

```json
{
    "jsonrpc": "2.0",
    "method": "token.update",
    "params": {
        "tokenid": "2",
        "expires_at": "0"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```
响应:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "tokenids": [
            "2"
        ]
    },
    "id": 1
}
```

[comment]: # ({/63919922-4f041664})

[comment]: # ({63651b34-63651b34})
### 来源

CToken::update() 位于 *ui/include/classes/api/services/CToken.php* 文件中。

[comment]: # ({/63651b34-63651b34})
