VMware {code} Community
geoffaviarc
Contributor
Contributor

ScreenTicket returned from vCloud API appears to be invalid

Hi

I'm trying to open the remote console plugin to access vm consoles in the browser.

I make a rest call to

https://10.0.11.31/api/v1.0/vApp/vm-273392803/screen/action/acquireTicket

which returns

<ScreenTicket xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://10.0.11.31/api/v1.0/schema/master.xsd">mks://10.0.11.43/vm-3218?ticket=TE-Q9%2B%2BXkIf4n6Ml60ojet7%2F1yQNLzvyknmwZHnbnVDuxbINMgQYDhXHwOMxCp7cbixPsnoOuP9%2FcqJNtQjvTRuErle4ddi%2BaNt-pDLeMtRtl8EVz2QGJzYRRIbn1mGoS0JCzt8TjWOrHKjhIc6v1ww4irTxXeUWRNT76r%2FxmieL5qHJuNs0YJGTOKmcpZ7DJmLbpIzd4qB9SUzbI6m9ltkiboGffBKRxQbwDsyEUHoW1j88kHyypXQNi3FfYfE%2BgIR7OgeibIz2nG0%3D</ScreenTicket>

from this String i extract the host, ticket and vm args required for the browser object....  the ticket part of the string appears to be URL encoded so i decode it then I push this to the browser and then use this code to launch the console.

<object id="mks" type="application/x-vmware-vmrc;version=2.5.0.279773"></object>

<script>

        var obj = document.getElementById('mks');
var ret = obj.connectWithSession('10.0.11.43', 'TE-Q9++XkIf4n6Ml60ojet7/1yQNLzvyknmwZHnbnVDuxbINMgQYDhXHwOMxCp7cbixPsnoOuP9/cqJNtQjvTRuErle4ddi+aNt-pDLeMtRtl8EVz2QGJzYRRIbn1mGoS0JCzt8TjWOrHKjhIc6v1ww4irTxXeUWRNT76r/xmieL5qHJuNs0YJGTOKmcpZ7DJmLbpIzd4qB9SUzbI6m9ltkiboGffBKRxQbwDsyEUHoW1j88kHyypXQNi3FfYfE+gIR7OgeibIz2nG0=','vm-3218', 2);
</script>
the object loads and the remote console app loads but I get and invalid ticket error.
Am I doing things correctly or is the vcloud API giving me invalid tickets?
Reply
0 Kudos
2 Replies
jake_robinson_b
Hot Shot
Hot Shot

The only thing I can think of is the 30 second ticket lifetime. After that, the ticket becomes invalid.

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
Reply
0 Kudos
cfor
Expert
Expert

One issue we have seen before was using .NET for rest and the screen ticket.  The ticket that comes back this way can not be used directly.  You must Url.Decode it first, then use the decoded ticket, and that works.  (Also as said before, you get 30 seconds to use the ticket from when it is created)

ChrisF (VCP4, VCP5, VCP-Cloud) - If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
Reply
0 Kudos