[GH-ISSUE #23] API Token Example? #19

Closed
opened 2026-02-26 17:32:08 +03:00 by kerem · 2 comments
Owner

Originally created by @noxomix on GitHub (Aug 16, 2023).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-php/issues/23

Hello, is there any example how to establish a connection via API-Token instead Username/Password?

  • When I do setApiToken() i cant connect.
    (- When I use token instead of the users password in the login() method it also not working)

What I forgot?

$client = new PveClient($cluster_data->hostname, $cluster_data->port);
$client->setApiToken($cluster_data->token);
$client->getVersion();

Would be nice if there is any example provided how to connect via Token.

Best Regards
Theo

Originally created by @noxomix on GitHub (Aug 16, 2023). Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-php/issues/23 Hello, is there any example how to establish a connection via API-Token instead Username/Password? - When I do setApiToken() i cant connect. (- When I use token instead of the users password in the login() method it also not working) What I forgot? ``` $client = new PveClient($cluster_data->hostname, $cluster_data->port); $client->setApiToken($cluster_data->token); $client->getVersion(); ``` Would be nice if there is any example provided how to connect via Token. Best Regards Theo
kerem closed this issue 2026-02-26 17:32:08 +03:00
Author
Owner

@noxomix commented on GitHub (Aug 16, 2023):

Okay however I figured it out 10 seconds after opening this issue. Didnt noticed that "UUID" in the format ment the actual token.

For everybody struggling with the same:

$client-> new PveClient($hostname, $port);
$client->setApiToken("root@pam!mycooltoken=<TOKEN>");
dd($client->getVersion());

:)

<!-- gh-comment-id:1680789333 --> @noxomix commented on GitHub (Aug 16, 2023): Okay however I figured it out 10 seconds after opening this issue. Didnt noticed that "UUID" in the format ment the actual token. For everybody struggling with the same: ```php $client-> new PveClient($hostname, $port); $client->setApiToken("root@pam!mycooltoken=<TOKEN>"); dd($client->getVersion()); ``` :)
Author
Owner

@franklupo commented on GitHub (Aug 16, 2023):

good. You are welcome.

<!-- gh-comment-id:1680813804 --> @franklupo commented on GitHub (Aug 16, 2023): good. You are welcome.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cv4pve-api-php#19
No description provided.