Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to refresh Ticket with previous Ticket? #181

Open
Leseratte10 opened this issue Dec 20, 2024 · 0 comments
Open

How to refresh Ticket with previous Ticket? #181

Leseratte10 opened this issue Dec 20, 2024 · 0 comments

Comments

@Leseratte10
Copy link

Leseratte10 commented Dec 20, 2024

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant