Trying to access 'Set-Cookie' out of a website

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
Smile_
Posts: 859
Joined: 03 May 2020, 00:51

Trying to access 'Set-Cookie' out of a website

05 Apr 2023, 15:54

My main goal here is to be able to login into a website, save cookies and then use these saved cookies later when I re-launch the AHK script so I don't have to re-log since the expiration date is not reached yet.
The website is Voobly, for testing you will need an account, simply fill forms here then create one (Email verification is not required, you can even use non-created emails), you can use the script directly still.

After some searching I understood from this post that I should find a header named Set-Cookie, the thing here is that that header is not showing up at all, from what I noticed it is Forbidden Header, but if I use Content-Type with value of application/json, it appears, however that makes the logging un-successful.

My script so far:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force

PostData := "username=" Username "&password=" Password "&login=submit"

Voobly := ComObject('WinHttp.WinHttpRequest.5.1')
Voobly.Open('GET', Website := 'https://www.voobly.com')
Voobly.Send()
Voobly.Open('POST', Website '/login/auth', False)
Voobly.SetRequestHeader('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0')
Voobly.SetRequestHeader('Referer', Website)
Voobly.SetRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
Voobly.Send(PostData)

Msgbox Voobly.GetAllResponseHeaders

If !InStr(Voobly.ResponseText, 'Welcome to Voobly!') {
	MsgBox('Could not log in correctly!', 'Log error', 16 ' T5')
	ExitApp
}

MsgBox('Welcome to Voobly!', 'Log success', 64)

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: apeironn, ntepa and 44 guests