[SOLVED] 401permission denied - invalid PVEVNC ticket

GeorgeCabraua

Member
May 21, 2022
2
0
6
1655312597883.png

I'm trying to call the console from an external site. I have successfully called so far:
GET / api2 / json / access / ticket
POST /api2/json/nodes/{node}/lxc/{vmid}/vncproxy
I'm trying to call now
GET / api2 / json / nodes / {node} / lxc / {vmid} / vncwebsocket

but it gives me an error. I don't understand where I'm wrong. Can it be from permissions?
 
It looks like you forgot to URI-Encode the vncticket parameter.

In Postman this can simply be done via the click of a button by selecting the text in the Params field and clicking "EncodeURIComponent".
1655457276879.png

In case you may want to do this in, for example, a Pre-request Script, the corresponsing javascript function would be encodeURIComponent( args... )
 
  • Like
Reactions: GeorgeCabraua
I have a similar question.
I have successfully get a ticket from POST /api2/json/nodes/{node}/qemu/{vmid}/vncproxy1658398936501.png

then I hit GET / api2 / json / nodes / {node} / qemu / {vmid} / vncwebsocket with the vncticket encoded, but it show 401 permission denied
1658399041679-png.39181

am I missing something here?
 

Attachments

  • 1658399041679.png
    1658399041679.png
    55.2 KB · Views: 285
I only could reproduce the error "invalid PVEVNC ticket" here if I intentionally messed with the data in the PVEVNC ticket or by waiting until it expired. (As far as I remember the ticket has a lifespan of 40 seconds, so you need to use it rather quickly - please make sure to use a ticket that is not expired!)

If the expiry isn't the problem, I would look out for other things like the vncticket being correct. If this doesn't help, it might also be worth a shot to try making these API calls in a script...
 
  • Like
Reactions: xjdeath1