/// <summary>
        ///     Refreshes the Steam session. Necessary to perform confirmations if your session has expired or changed.
        /// </summary>
        /// <returns></returns>
        public void RefreshSession(SteamWeb web, BfCallback callback)
        {
            string url      = ApiEndpoints.MOBILEAUTH_GETWGTOKEN;
            var    postData = new Dictionary <string, string>();

            postData.Add("access_token", this.Session.OAuthToken);

            web.Request(url, "POST", postData, (response, code) =>
            {
                if (response == null || code != HttpStatusCode.OK)
                {
                    callback(Success.Error);
                    return;
                }

                try
                {
                    var refreshResponse = JsonConvert.DeserializeObject <WebResponse <RefreshSessionDataResponse> >(response);
                    if (string.IsNullOrEmpty(refreshResponse?.Response?.Token))
                    {
                        callback(Success.Failure);
                        return;
                    }

                    string token       = this.Session.SteamID + "%7C%7C" + refreshResponse.Response.Token;
                    string tokenSecure = this.Session.SteamID + "%7C%7C" + refreshResponse.Response.TokenSecure;

                    this.Session.SteamLogin       = token;
                    this.Session.SteamLoginSecure = tokenSecure;
                    Storage.PushStore(this.Session);

                    callback(Success.Success);
                }
                catch (Exception)
                {
                    callback(Success.Error);
                }
            });
        }
Esempio n. 2
0
 public void RefreshSession(SteamWeb web, BfCallback callback)
 {
     throw new NotImplementedException();
 }