Sign In Register

How can we help you today?

Start a new topic

Steam Connect Request

I am attempting to use SteamConnectRequest to link players with Steam accounts. I've double checked the Integration page to make sure I'm using the correct Steam App ID and Steam API Key.

I use Steamworks' GetAuthSessionTicket to receive a ticket (which I know returns a valid ticket since it works for Steam's BeginAuthSession). After converting the response to a hex encoded string, I end up with a string that is similar to the session ticket string in the Example Request on the SteamConnectRequest page (http://bit.ly/1OLQg3B).

However, after creating the SteamConnectRequest and setting it up with the newly created hex encoded ticket, it always returns with the NOTAUTHENTICATED error.


Is there anything I could be missing in this process that would guarantee this never works correctly, or any places to look? Here is the code I am using, if more information is needed I will be happy to oblige, thanks!


// GetAuthSessionTicket

byte[] ticket = new byte[1024];

uint length = 0;

HAuthTicket authTicket = SteamUser.GetAuthSessionTicket(ticket, 1024, out length);


// GetAuthSessionTicket Callback

if(SteamUser.BeginAuthSession(ticket, (int)length, SteamUser.GetSteamID() == EBeginAuthSessionResult.k_EBeginAuthSessionResultOK)

{

   string hexEncodedTicket = "";

   for (int i = 0; i < length; i++)

        hexEncodedTicket += String.Format("{0:X}", ticket[i]);


   new GameSparks.Api.Requests.SteamConnectRequest()

          .SetDoNotLinkToCurrentPlayer(false)

          .SetSessionTicket(hexTicket)

          .Send((response) =>

          {

              if (!response.HasErrors)

              {

                  Debug.Log("Authenticated);

              }

              else

              {

                  Debug.Log("NOTAUTHENTICATED");

              }

          });

}


I fixed it, it was the steam key, it contained a bad character.

But now,...I get this error:

  

GS: RECV:{"@class":".AuthenticationResponse","error":{"steamTicket":"NOTAUTHENTICATED","steamError":"Received HTTP status code 403"},"newPlayer":false,"requestId":"636746839185385766_0"}
UnityEngine.Debug:Log(Object)
GameSparks.Platforms.<DebugMsg>c__AnonStorey0:<>m__0() (at Assets/GameSparks/Platforms/PlatformBase.cs:452)
GameSparks.Platforms.PlatformBase:Update() (at Assets/GameSparks/Platforms/PlatformBase.cs:272) 

  

I always get the error 104:

 

GS: RECV:{"@class":".GameSparksErrorResponse","error":{"message":"Illegal character in query at index 104: https://api.steampowered.com/ISteamUserAuth/AuthenticateUserTicket/v1/?format=json&key=XXX-XXX-XX&appId=_____&ticket=____"},"message":"Illegal character in query at index 104: https://api.steampowered.com/ISteamUserAuth/AuthenticateUserTicket/v1/?format=json&key=____&appId=___&ticket=.....","requestId":"636746813627001570_0"}

UnityEngine.Debug:Log(Object)

GameSparks.Platforms.<DebugMsg>c__AnonStorey0:<>m__0() (at Assets/GameSparks/Platforms/PlatformBase.cs:452)

GameSparks.Platforms.PlatformBase:Update() (at Assets/GameSparks/Platforms/PlatformBase.cs:272)

 

Hi Liam, 


yeah you are right, I forgot configure Steam integrations on GameSparks portal. 

But I'm not sure what I have to fill in "Steam API Key". 


I found this Web Api Key, but I'm not sure is "Web Api Key", is the correct form for "Steam Api Key". And if is it right, what kind of domain I have to fill it: gamesparks.com ? 


https://steamcommunity.com/dev/apikey


Thank you,

Petr 


Hi Petr,


This simply means the Steam integration isn't configured on the Portal. You'll need to configure it in preview to test in preview. To use it on live make sure the configuration is in place on preview, create a snapshot and then publish it. You should be good to go then.


Regards,

Liam 

Hello 


I'm using this example of script from Anders Pettersson and I'm getting error:

Error Registering Player... 
 {"STEAM":"NOT_CONFIGURED"}

 Do you have an advice what I'm doing wrong ? 


Thank you,

Petr

Anders,


Just to be sure, are you logged in to Steam with an account that has access to the game in development?


Cheers,

Jonas

Hi,


I'm also having this issue (8 months later) and I'm at a loss. My app ID and webapi seem to be set up correctly, I can get the ticket from steam but if I try to login to GameSparks I get 102 - Ticket for another app NOT AUTHENTICATED


  

byte[] ticket = new byte[1024];
        uint pcbTicket = 0;
        HAuthTicket authTicket = SteamUser.GetAuthSessionTicket(ticket, 1024, out pcbTicket);

        if(authTicket == HAuthTicket.Invalid)
        {
            Debug.Log("############# Error getting steam authentication ticket");

        }

        print("SteamUser.GetAuthSessionTicket(Ticket, 1024, out pcbTicket) - " + authTicket + " -- " + pcbTicket);

        EBeginAuthSessionResult ret = SteamUser.BeginAuthSession(ticket, (int)pcbTicket, SteamUser.GetSteamID());
        print("SteamUser.BeginAuthSession(m_Ticket, " + (int)pcbTicket + ", " + SteamUser.GetSteamID() + ") - " + ret);

        string hexEncodedTicket = "";
        for(int i = 0; i < pcbTicket; i++)
            hexEncodedTicket += string.Format("{0:X2}", ticket[i]);

 if I then do  


 

new GameSparks.Api.Requests.SteamConnectRequest()
            .SetDoNotLinkToCurrentPlayer(false)
            .SetErrorOnSwitch(false)
            .SetSessionTicket(sessionTicket)
            .SetSwitchIfPossible(true)
            .SetSyncDisplayName(true)
            .Send((response) => {
                string authToken = response.AuthToken;
                string displayName = response.DisplayName;
                bool? newPlayer = response.NewPlayer;
                GSData scriptData = response.ScriptData;
                var switchSummary = response.SwitchSummary;
                string userId = response.UserId;

            });

 this always returns error 102. What am I missing here? I tried commenting out the BeginAuthSession code, but the result is the same. 



To anyone reading this in the future, it was a combination of two issues. One was what Alex mentioned, the improper formatting. This is what you want:


string hexEncodedTicket = "";

   for (int i = 0; i < length; i++)

        hexEncodedTicket += String.Format("{0:X2}", ticket[i]);


The second is that BeginAuthSession essentially uses the ticket up, making it invalid for any future use. So you can't call that immediately before trying to use to connect with GameSparks, it'll never work.


Thanks to everyone who helped figure this out, you guys are awesome!

James


2 people like this

Hi James, 


I was looking at your latest SteamConnectRequests. It seems like all the ones from 1st and 2nd June contain a token that was incorrectly formatted (without the fix that you put in on 31May), so it looks like you are no longer submitting correct tokens.


Also, I tried using one token that was correctly formatted and I got back this error: { "error" : { "errorcode" : 100 , "errordesc" : "User is offline"}} . When you are doing these authentications, is your steam user online? Can we do a test when you are actually logged in with this user and I try to authenticate to see if that works?


Thanks, 

Alex


Absolutely!

To get the App ID I simply signed into partner.steamgames.com. The App ID is right there next to the name of the App, and this ID is definitely correct as Steam recognizes anytime I am running our build.

To get the API key, starting at the home page that signing in takes me to, I go to Users & Permissions > Manage Groups. On this page we have one group for our game which I opened. And on the right of this last page is an option to Create Web API key that I copied and pasted to Steam Integration.


I tried generating a token and copying and pasting it into the Test Harness, that also gave me NOTAUTHENTICATED.


James

Hi James,


If possible can you go through the process of getting your appID and key from Steam again from the start ? Can you detail the steps you are following while you are doing this, hopefully then we 'll spot the issue. Also when you have done this can you generate a token for a user and test it with a SteamConnectRequest in the Test Harness ?


Thanks,

Liam

My Steam App ID is correct, however my Web API key is not used by the client at all.


James

Hi James,


Thanks for the update, we'll keep looking into this for you in the meantime. It does sound like a possible issue with the api key you're using, can you also check that the app Id and secret on the client side match your set up in the steam integration tab on the portal ?


Regards,

Liam

We do not, we have one game with no demo. I just checked the App ID again and it is correct, though it is entirely possible I am using the wrong key for the Steam API Key. The key I am using is labeled is the Web API Publisher Key in Steam's tools and is 32 characters long. It has been copied over properly but if I am meant to use a different key entirely than that could very well be the issue.


James

Hi James,


Do you have any other instances of the game set up on Steam ? A demo version alongside the full one perhaps ? It might be possible that you're getting the token from the wrong instance and trying to use that to authenticate with the one you have configured in GameSparks, which could in turn lead to this error, can you double check on Steam that you are using the correct Steam App ID and Steam API Key.


Thanks,

Liam

Login to post a comment