question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auth+Ticket+Ticket Validation Example?

See original GitHub issue

EDIT

Skip to bottom – in between is progression.

Original Issue

I could only find Auth.GetAuthSessionTicket that returns a byte[] via _ticket.data:

What do I do from there? In Steamworks.net, it’s stupidly complicated to convert it, then you need to send it away for a callback:

ticketBlob = new byte[1024];

// Retrieve ticket; hTicket should be a field in the class so you can use it to cancel the ticket later
// When you pass an object, the object can be modified by the callee. This function modifies the byte array you've passed to it.
hTicket = SteamUser.GetAuthSessionTicket(ticketBlob, ticketBlob.Length, out ticketSize);

// Resize the buffer to actual length
Array.Resize(ref ticketBlob, (int)ticketSize);

// Convert bytes to string
StringBuilder sb = new StringBuilder();
foreach (byte b in ticketBlob)
{
	sb.AppendFormat("{0:x2}", b);
}
hexTicket = sb.ToString(); // Final result: Then you send it off to Steam to get verified. Send this hexTicket to your BaaS or oAuth2.

// Wait for OnGetAuthSessionTicketResponse to confirm the ticket is valid =>

private void OnGetAuthSessionTicketResponse(GetAuthSessionTicketResponse_t callback)
{
    // Confirm validity of ticket here
}

How do I do the Facepunch equiv of this? Rather:

  1. How do you convert an Auth.Ticket to string (the final form)?
  2. How do I validate the ticket (OnGetAuthSessionTicketResponse() equiv.)?

There used to be an example link via this issue ( https://github.com/Facepunch/Facepunch.Steamworks/issues/52 ). However, it’s now 404.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
igniusscommented, Oct 24, 2018

If you want to verify the session ticket in a single player experience you’d need to post it to the AuthenticateUserTicket web-api of steamworks, not Server.Instance

The other method would be having a dedicated server that initializes a Server instance example: var server = new Facepunch.Steamworks.Server(252490, options); (see the Facepunch.Test assembly for a big example)

After which you can use the StartSession part on the server, and send a callback to the client if it was correct or not.

I haven’t played around with it yet but,

byte[] ticketBlob = authTicket.Data;
string s = string.Concat(ticketBlob.Select(b => b.ToString("X2")));

seems correct, should just post it to the webapi (see the Steam WebAPI doc for more info )

You can also See this Test-code to see it’s working only difference is you’re testing it locally instead of sending over the binary to the server who then checks it.

1reaction
dylanh724commented, Nov 17, 2018

Alas, it seems that 50%+ of the time, users are getting an "Invalid Ticket:

{ \"response\" : { \"error\" : { \"errorcode\" : 101 , \"errordesc\" : \"Invalid ticket\"}}}

Anyone know what would cause this?

Related: https://github.com/Facepunch/Facepunch.Steamworks/issues/217

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kofax Supplier Portal API Guide
This service is used to authenticate a Supplier Portal user against the Supplier Portal endpoint, using a username and password as authentication credentials....
Read more >
ReadSoft Supplier Portal API Guide
This service is used to authenticate a Supplier Portal user against the Supplier Portal endpoint, using a username and password as authentication credentials....
Read more >
cdp.dll - powered by Falcon Sandbox
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to fight malware.
Read more >
Bio Smart Kerberos
Authentication Server ( El Servidor de Autentificación KAS). ... especificado por el predicado SuccValid( C, Ticket, Auth), Ticket: TICKET y Auth: AUTH, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found