NOTAUTHENTICATED - Expired/Invalid Steam Ticket: authTicket.Cancel() is not cancelling as it's supposed to
See original GitHub issueThere’s no cancel last ticket function like found in Steamworks.net (which seemed to work fine with this) – however, if you request a new Auth.Ticket, it will always give you the last [same] one so you can cancel it. The next time you get a ticket, it will give you a different one.
However, our users are constantly getting timeouts due to invalid tickets. It seems that the tickets are not cancelling as they should:
What is the proper way to get a new auth ticket while cancelling the old one? This does not work:
function Auth.Ticket getTicket()
{
// Get last ticket and cancel
Auth.Ticket oldTicket = s_client.Auth.GetAuthSessionTicket();
oldTicket.Cancel();
// Get a new ticket
Auth.Ticket newTicket = s_client.Auth.GetAuthSessionTicket();
return newTicket;
}
Users are getting expired/invalid ticket
responses (NOTAUTHENTICATED
): The only way to get a real ticket is to try again a few times – I’m not sure if it’s a time or number of tries. Probably time:
Do I need to yield a period of time after cancelling a ticket before getting a new one? What is the proper method for this?
We cancel tickets @ onDestroy as directed in the demo, but that doesn’t seem to be good enough. We also tried to cancel them directly before getting a new one - that doesn’t seem to work, either.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top GitHub Comments
As an update, it seems that yielding 0.5 seconds after cancelling the ticket (before getting a new one) seems to do the trick. I could probably lower that timer.
While I’m still testing this, if this continues to work, would that mean that there is an unimplemented callback to the
Auth.Ticket.Cancel()
func that we’d normally have to wait on before continuing?EDIT 1
https://partner.steamgames.com/doc/features/auth
It seems that there should actually be a callback to ensure a valid auth ticket session – this was available in sw.net, but can’t seem to find it in fp.sw
This is literally facepunch issue 😃. This method is handled with callback on steam Api. The reason is obvious as steam client has to first communicate the ticket with steam servers so you can use it for authentication with 3rd party server in next step. This takes time, can fail, etc.
The current implementation here is not using this callback and immediately returning unconfirmed byte array.
@MichalPetryka your solution is almost right, except you just stalled the thread from which the method call is made. This is very bad and should not be solved this way.
The method should be reworked to something like
public void GetAuthSessionTicket(Action<Ticket> callback)
And status of operation should be included in ticket so developer can react on failed attempts. (The result status is returned in Steam callback GetAuthSessionTicketResponse_t)
The solution with delayed call might work in some cases but I would not recommend go with such fix in any serious release that require this functionality to work properly and reliable.