question

Fabien RENAULT avatar image
Fabien RENAULT asked

Login with steam - 400 - BadRequest - UnknownError

Hi,

I'm trying to log playfab using this - Setting up PlayFab authentication using Steam and Unity -

I don't have my own AppID, so i use the test one 480.

I have set my own api key get on - steamcommunity dev apikey - and save it in playfab/Add-ons/Steam

When i try to log in, i have this error :

Here my code (copy/paste from the tutorials)

using PlayFab;
using PlayFab.ClientModels;
using Steamworks;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;


public class SteamTest : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        if (!SteamManager.Initialized)
        {
            return;
        }
        string name = SteamFriends.GetPersonaName();
        Debug.Log(name);
    }


    public string GetSteamAuthTicket()
    {
        byte[] ticketBlob = new byte[1024];
        uint ticketSize;


        // 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.
        HAuthTicket 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);
        }
        return sb.ToString();
    }


    public void OnGUI()
    {
        if (GUILayout.Button("Log In"))
        {
            if (SteamManager.Initialized)
            {
                // Execute PlayFab API call to log in with steam ticket
                PlayFabClientAPI.LoginWithSteam(new LoginWithSteamRequest
                {
                    CreateAccount = true,
                    SteamTicket = GetSteamAuthTicket()
                }, OnComplete, OnFailed);
            }
        }
    }


    // Utility callbacks to log the result
    private void OnComplete(LoginResult obj)
    {
        Debug.Log("Success!");
    }


    private void OnFailed(PlayFabError error)
    {
        Debug.Log("Failed: " + error.GenerateErrorReport());
    }
}


Have you any idea ?

Thanks,

Best regards.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

There are few reasons that will cause Steam WebAPI error: 0 (). Please refer the following threads:

Please feel free to tell us if there are any other issues.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Fabien RENAULT avatar image Fabien RENAULT commented ·

Thanks for the info, after looking for other threads, i saw this one :

It seems that i cannot use the test AppID and need to have my own...

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.