MyBB Community Forums

Full Version: External script (TCL) cannot login anymore with MyBB1.8.21
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there,

I made a long time away a script in TCL to automaticaly connect to one of my MyBB and parse a forum to warn me if there are new message.
Since I upgrade to 1.8.21, the script alway get the Authorization code mismatch. Are you accessing this function correctly? error.
I can connect easily with the same user with firefox or lynx, no trouble. My forum works perfectly for anyone.

Here is the interesting part of my code:
set ::max-socks 10000
set httpconfig [::http::config -useragent $agent]

set tok1 [::http::geturl $website/index.php]
upvar \#0 $tok1 state
set cookies [list]
foreach {name value} $state(meta) {
	if { $name eq "Set-Cookie" } {
		lappend cookies [lindex [split $value {;}] 0]
set index [::http::data $tok1]
regexp -nocase -- {<input name="my_post_key" type="hidden" value="([^"]+)" />} $index -> mykey
set login [::http::formatQuery action do_login url "" my_post_key $mykey username MYUSER password MYPASS]
set tok [::http::geturl $website/member.php -query $login]
upvar \#0 $tok state
set cookies [list]
foreach {name value} $state(meta) {
	if { $name eq "Set-Cookie" } {
		lappend cookies [lindex [split $value {;}] 0]
set debug [::http::data $tok]
set html [open "/debuglogin.html" "w"]
puts $html $debug
close $html
::http::cleanup $tok

The my_post_key value is well get and sent, but my debuglogin.html page is alway with the error (and a new my_post_key value).

I did trace with Lynx and firefox, I post exactly the same datas in the same order. And, I repeat, it was working with previous versions of MyBB.
Any idea or suggestion ?

nota My forum is using cloudflare, but it alway do and it wasn't a trouble before.
For people interested in that, I finally found the answer.
I had to pass the cookies when loading member.php page:
set tok [::http::geturl $website/member.php -query $login -headers [list Cookie [join $cookies {;}]]]