[GH-ISSUE #181] How to refresh Ticket with previous Ticket? #46

Open
opened 2026-03-03 15:29:52 +03:00 by kerem · 0 comments
Owner

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:

bad request: 400 Parameter verification failed. - {"password":"property is missing and it is not optional","username":"property is missing and it is not optional"}

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?

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: ``` bad request: 400 Parameter verification failed. - {"password":"property is missing and it is not optional","username":"property is missing and it is not optional"} ``` 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?
Sign in to join this conversation.
No labels
pull-request
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/go-proxmox#46
No description provided.