diff --git a/index.js b/index.js index c38f109..0705913 100644 --- a/index.js +++ b/index.js @@ -165,9 +165,9 @@ SteamCommunity.prototype._setCookie = function(cookie, secure) { SteamCommunity.prototype.setCookies = function(cookies) { cookies.forEach((cookie) => { - var cookieName = cookie.match(/(.+)=/)[1]; + var cookieName = cookie.trim().split('=')[0]; if (cookieName == 'steamLogin' || cookieName == 'steamLoginSecure') { - this.steamID = new SteamID(cookie.match(/=(\d+)/)[1]); + this.steamID = new SteamID(cookie.match(/steamLogin(Secure)?=(\d+)/)[2]); } this._setCookie(Request.cookie(cookie), !!(cookieName.match(/^steamMachineAuth/) || cookieName.match(/Secure$/)));