[comment]: # translation:outdated

[comment]: # ({4480ea6d-4480ea6d})
# token.generate

[comment]: # ({/4480ea6d-4480ea6d})

[comment]: # ({7d5e371f-3f13b874})
### Opis

`object token.generate(array tokenids)`

Ta metoda umożliwia generowanie tokenów.

::: noteclassic
Uprawnienie *Manage API tokens* [permission](/manual/web_interface/frontend_sections/users/user_roles#configuration) jest wymagane, aby rola użytkownika mogła zarządzać tokenami innych użytkowników.
:::

::: noteimportant
Token może zostać wygenerowany tą metodą tylko wtedy, gdy został [utworzony](create).
:::

[comment]: # ({/7d5e371f-3f13b874})

[comment]: # ({db2ee95a-db2ee95a})
### Parametry

`(array)` ID tokenów do wygenerowania.

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

[comment]: # ({27f911c0-101a0040})
### Zwracane wartości

`(array)` Zwraca tablicę obiektów zawierających identyfikator wygenerowanego
tokenu we właściwości `tokenid` oraz wygenerowany ciąg autoryzacyjny
we właściwości `token`.

|Właściwość|[Type](/manual/api/reference_commentary#data-types)|Opis|
|--|--|------|
|tokenid|ID|Identyfikator tokenu.|
|token|string|Wygenerowany ciąg autoryzacyjny dla tego tokenu.|

[comment]: # ({/27f911c0-101a0040})

[comment]: # ({b41637d2-b41637d2})
### Przykłady

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

[comment]: # ({7c083659-c0623539})
#### Wygeneruj wiele tokenów

Wygeneruj dwa tokeny.

[Żądanie](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "token.generate",
    "params": [
        "1",
        "2"
    ],
    "id": 1
}
```

Odpowiedź:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "tokenid": "1",
            "token": "bbcfce79a2d95037502f7e9a534906d3466c9a1484beb6ea0f4e7be28e8b8ce2"
        },
        {
            "tokenid": "2",
            "token": "fa1258a83d518eabd87698a96bd7f07e5a6ae8aeb8463cae33d50b91dd21bd6d"
        }
    ],
    "id": 1
}
```

[comment]: # ({/7c083659-c0623539})

[comment]: # ({39ba5785-39ba5785})
### Źródło

CToken::generate() w *ui/include/classes/api/services/CToken.php*.

[comment]: # ({/39ba5785-39ba5785})
