project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Bug] Proxmox Backup Server Integration using API Token always fails with a Connection failed: Ticket auth failed: HTTP 401

Open nvaert1986 opened this issue 2 months ago • 4 comments

Describe the bug

Proxmox Backup Server Integration using API Token always fails with a Connection failed: Ticket auth failed: HTTP 401

Steps to Reproduce

  1. Try configuring a Proxmox Backup Server using an API Token ID using root@pam!anything with a token
  2. Give the API user admin permissions
  3. Observe the error

Expected behavior

It should show the details. I currently work around this by using root@pam with the password directly.

Environment

  • PegaProx Version: 1.1.1
  • Installation Method: Manual
  • OS: Debian 13
  • Browser: Mozilla Firefox 155.0.1 and Google Chrome 151
  • Behind Reverse Proxy? No
  • **UI?**Corporate

Logs

Not Applicable


Screenshots

Not Applicable

Checklist

  • [X] I have searched existing issues to make sure this is not a duplicate
  • [X] I am using the latest version of PegaProx

nvaert1986 avatar Sep 10 '26 12:09 nvaert1986

The error text is the useful part here: "Ticket auth failed" is the password path. We pick token over password whenever both an id and a secret are present, so that message means the manager had no secret to work with — it never tried the token at all.

I went through the chain and it looks right on paper: connect prefers the token, the add route hands the form data straight through, and the form has both fields plus a check that one of password/token is filled. So I need two things from you to narrow it down: did you fill in the secret field as well as the token id, and was this a brand new PBS entry or did you convert an existing password-based one? The edit path masks stored secrets and that is the spot I would suspect on a conversion.

— MK

mkellermann97 avatar Sep 10 '26 13:09 mkellermann97

The error text is the useful part here: "Ticket auth failed" is the password path. We pick token over password whenever both an id and a secret are present, so that message means the manager had no secret to work with — it never tried the token at all.

I went through the chain and it looks right on paper: connect prefers the token, the add route hands the form data straight through, and the form has both fields plus a check that one of password/token is filled. So I need two things from you to narrow it down: did you fill in the secret field as well as the token id, and was this a brand new PBS entry or did you convert an existing password-based one? The edit path masks stored secrets and that is the spot I would suspect on a conversion.

— MK

To answer your questions:

  • Yes, I filled in both the Token ID (username) and token. This is an existing connection that was using SSH based credentials, which I was editing. I reverted back to SSH credentials and works fine with SSH credentials, just the API credentials refuse to work.

nvaert1986 avatar Sep 11 '26 06:09 nvaert1986

That narrows it usefully — an edit on an existing entry, not a fresh one.

I traced the whole chain again with that in mind: form → PUT → save → manager rebuild. It holds. The masked-password sentinel gets swapped back correctly, the token fields are sent verbatim, and the save doesn't touch the dict the manager is built from. So I'm not going to guess a third time.

One thing would settle it. Save it with the token again, then in the browser console:

fetch('/api/pbs', {credentials:'same-origin'}).then(r=>r.json())
  .then(l => console.log(l.map(p => [p.name, p.using_api_token, p.api_token_id])))

If using_api_token is false, the manager never took the token and it's ours. If it's true and auth still fails, it's the token or its permissions on the PBS side and I'll tell you where to look.

Also worth double checking: the Token ID belongs in the dedicated "API Token ID" field as user@realm!tokenname, not in the Username field above it. You wrote "Token ID (username)" and that's the one mix-up that would produce exactly this error.

Cheers — MK · https://opencollective.com/pegaprox

mkellermann97 avatar Sep 11 '26 13:09 mkellermann97

Thanks for sticking with this one. PBS servers now connect with an API token however it is entered, either in the API Token ID and secret fields or as user@realm!tokenname in the username field with the secret in the password field, and the Test button in the edit dialog no longer sends the masked placeholder instead of the stored secret. This ships in 1.3.0.

If this one made your week easier, https://opencollective.com/pegaprox is where the project gets its funding.

Marcus

mkellermann97 avatar Oct 07 '26 04:10 mkellermann97