pve2-api-php-client
pve2-api-php-client copied to clipboard
Add API Token Auth Support
Add the support for auth with API Token
How it works
the class now parse the password parameter ($this->password). if there a ":" in password they will be use token authentification.
if not the class is use username + password authentification
So the class is compatible backwards
How to use
Login with username & password: $pve2 = new PVE2_API("hostname", "username", "realm", "password");
Login with API Token: $pve2 = new PVE2_API("hostname", "username", "realm", "TokenID:TokenValue");
Example: $pve2 = new PVE2_API("hostname", "root", "pam", "TestToken:7381a050-0185-43d1-a651-0c30a2bba5cc");
I think that using the presence of a colon in the password is too unpredictable, especially in current times.
Perhaps if the password field is null when PVE2_API is initiated, a new field in the request can be checked?
- hostname
- username
- realm
- password
- ticket