1 year ago

#261400

test-img

Psiloc

MediaWiki API login: "Unable to continue login. Your session most likely timed out."

Trying to create an invite only wiki, that we can login to with a bot account once the customer has authenticated using our own webpage on our corporate website.

I've been using the documentation from here: https://www.mediawiki.org/wiki/API:Login

Anyway I can get a success response from the API sandbox, but the POST from our new API interface webpage errors with "Unable to continue login. Your session most likely timed out."

I get the same message even if I deliberately enter invalid login credentials, so I would imagine it's not getting as far as actually checking the username/password/token. It's really annoying that there's no decent error to work from.

GETting a token via action=query works fine from the same webpage.

Our webpage is a web forms page written in VB (I know).

                ServicePointManager.Expect100Continue = True
                ServicePointManager.SecurityProtocol = DirectCast(3072, SecurityProtocolType)
                ServicePointManager.DefaultConnectionLimit = 9999

                Dim webClient As New System.Net.WebClient
                Dim result As String = webClient.DownloadString("https://tmsinsight.com/TMSWiki/api.php?action=query&meta=tokens&type=login&format=json")
                Dim j As Object = New JavaScriptSerializer().Deserialize(Of Object)(result)

                Dim LoginToken As String = j("query")("tokens")("logintoken")
                Response.Write(LoginToken & "<br/>")

                webClient.Headers(HttpRequestHeader.ContentType) = "application/x-www-form-urlencoded"
                Dim parameters = New NameValueCollection()
                parameters.Add("action", "login")
                parameters.Add("format", "json")
                parameters.Add("lgname", "botusername@botusername")
                parameters.Add("lgpassword", "botpassword")
                parameters.Add("lgtoken", LoginToken)
                Dim responsebytes = webClient.UploadValues("https://tmsinsight.com/TMSWiki/api.php", "POST", parameters)
                Dim resultRequest = Encoding.UTF8.GetString(responsebytes)
                Response.Write(resultRequest)

webforms

mediawiki

mediawiki-api

0 Answers

Your Answer

Accepted video resources