Facepunch / Facepunch.Steamworks

Another fucking c# Steamworks implementation
MIT License
2.85k stars 344 forks source link

Steamworks.SteamServer.BeginAuthSession throws a NullPointerException #517

Open jazzbach opened 3 years ago

jazzbach commented 3 years ago

Hello,

I'm using Facepunch.Steamworks V 2.3.2 for Unity and I'm trying to validate a AuthSessionTicketwith theSteamworks.SteamServer.BeginAuthSession method. I'm following all the steps verbatim from the example at Github:

Github Auth example:

// Client sends ticket data to server somehow
    var ticket = SteamUser.GetAuthSessionTicket();

    // server listens to event
    SteamServer.OnValidateAuthTicketResponse += 
        ( steamid, ownerid, rsponse ) =>
    {
        if ( rsponse == AuthResponse.OK )
            // DO SOMETHING WITH THE VALID TICKET
        else
            KickUser( steamid );
    };

    // server gets ticket data from client, 
    // calls this function.. which either returns
    // false straight away, or will issue a TicketResponse.
    if ( !SteamServer.BeginAuthSession( ticket.Data, Steamworks.SteamClient.SteamId) ) // THIS IS WHERE I HAVE THE ISSUE
    {
        KickUser( clientSteamId );
    }

    //
    // Client is leaving, cancels their ticket 
    // OnValidateAuth is called on the server again
    // this time with AuthResponse.AuthTicketCanceled
    //
    ticket.Cancel();

The ticket is retrieved succesfully but if I try to validate it (ticket.Data) with SteamServer.BeginAuthSession, the following error is thrown:

NullReferenceException: Object reference not set to an instance of an object
Steamworks.SteamServer.BeginAuthSession (System.Byte[] data, Steamworks.SteamId steamid) 
(at D:/a/Facepunch.Steamworks/Facepunch.Steamworks/Facepunch.Steamworks/SteamServer.cs:380)

The weird part is that, the NullPointerExceptionerror shows a local path which I don't have at all in my computer at all: D:/a/Facepunch.Steamworks/Facepunch.Steamworks/Facepunch.Steamworks/SteamServer.cs:380

I don't understand what I'm doing wrong. All I want to do is to validate the ticket and have some code in the SteamServer.OnValidateAuthTicketResponse event.

Thanks in advance.

HoverCatz commented 3 years ago

Same.

danbopes commented 1 year ago

Were you able to solve this?