mirror of
https://github.com/luthermonson/go-proxmox.git
synced 2026-04-26 01:15:57 +03:00
[GH-ISSUE #181] How to refresh Ticket with previous Ticket? #46
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/go-proxmox#46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Leseratte10 on GitHub (Dec 20, 2024).
Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/181
According to the following post on the Proxmox forums, the API supports renewing a Ticket with just the previous ticket: https://forum.proxmox.com/threads/api-how-to-get-new-ticket.19034/
That way, a client that's always running can always renew their ticket with the previous one and does not have to re-authorize.
However, I was unable to get this to work in go-proxmox; is this feature not supported yet?
If I call the Client.Ticket() function, it expects a "Credential" object. If I set that to "nil", I get the following error:
If I instead set credential to a Credential object with just the "username" property, I get "not authorized to access endpoint".
If I try to build the "full" API request as explained in that forum post (username, realm, password), that doesn't work because to extend a Ticket you need to pass the previous Ticket as the password value, and as the Client has no method like "GetCurrentTicket", I'm unable to do that. (Or is there a way to extract / get access to the current ticket that I'm missing?)
Right now I'm just building a whole new Credentials object as a workaround, including Realm, Username and Password - that works, but it's ugly because it means A) I need to store the user password to re-authenticate every two hours, and B) it doesn't work with OTP since the user's original OTP from the initial login has already expired.
I'm probably making some stupid mistake as I haven't used Go very much in the past - is there example code somewhere on how to renew a Ticket without re-authenticating using a Password/Token/2FA, just by using the previous Ticket, to keep the session active? Or is that just not supported by this client yet?