Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Website authentication tends to work as follows:</p> <ol> <li>The user submits (via an HTTP POST action) credentials to the server</li> <li>If the credentials are correct, the server responds with a session token and potentially other cookie tokens. The browser stores these and returns them with every request to the server.</li> </ol> <p>Perhaps the easiest option would be to programattically fill out the form in a WebBrowser control and submit it. The steps required to do that are <a href="https://stackoverflow.com/questions/2299273/how-do-i-submit-a-form-inside-a-webbrowser-control">discussed here</a>. The main steps would be to identify the form elements you want to manipulate (the username and password field), all of which can be done using the various developer tools available in most web browsers.</p> <p>Another option would be to submit the login details using HttpClient and to then pass the received session and cookie data to the WebBrowser control. Looking at wikipedia, the login field seems to submit via POST:</p> <pre><code>URL: https://en.wikipedia.org/w/index.php?title=Special:UserLogin&amp;action=submitlogin&amp;type=login&amp;returnto=Main+Page wpName: &lt;username&gt; wpPassword: &lt;password&gt; wpRemember: 1|0 wpLoginAttempt: Log in wpLoginToken: &lt;a token from a hidden form input&gt; wpForceHttps: 0 </code></pre> <p>I figured that out by using Google Chrome's developer tools (press F12) under the Network tag. If you submit a form you can generally find the POST request (as opposed to most HTTP GET requests) which contains the form information.</p> <p>The biggest problem you'll have here is probably the hidden token in the form. I'd imagine it's present to stop automated logins from anywhere other than the login form. If mediawiki uses this by default there's no easy way of bypassing it if you don't control the mediawiki installation. At that point, you might as well just use the first method (as you'll have to access the DOM to get the token).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload