0

        <div class="mainLoginLeftPanel_signin">
            <label for="steamAccountName">Steam username</label><br>
            <input class="textField" type="text" name="username" id="steamAccountName" maxlength="64" tabindex="1" value=""><br>&nbsp;<br>
            <label for="steamPassword">Password</label><br>
            <input class="textField" type="password" name="password" id="steamPassword" autocomplete="off" maxlength="64" tabindex="2"><br>

Since you can't emulate key-pressing in jsoup is there away to somehow login into a site? maybe somehow setting your cookie?

  • Possible duplicate of [Jsoup connection with basic access authentication](http://stackoverflow.com/questions/7679916/jsoup-connection-with-basic-access-authentication) – avojak Jul 16 '16 at 05:35
  • You have to build and send the correct POST request, save the returned token (in a cookie) and keep sending that on subsequent requests. – Jim Garrison Jul 16 '16 at 05:36
  • @avojak This doesn't appear to be basic-auth – Jim Garrison Jul 16 '16 at 05:36
  • Is there any documentation or examples on how to do that? @JimGarrison –  Jul 16 '16 at 05:39
  • Learn to use your browser's debug console to examine the requests and responses, so you can learn what the site required. Then emulate that in JSoup. After you understand the transaction, read the JSoup documentation to learn how to do it. – Jim Garrison Jul 16 '16 at 05:43
  • so there is no example of how to do what I want? –  Jul 16 '16 at 05:49

1 Answers1

0

After getting the the users credentials, you could then try doing an HTTP Post Request to steam via Java.

Since I have never actually tried doing an HTTP Request in Java, I can't tell you how to do it. But this looks promising Sending HTTP POST Request In Java

Quickly taking a look at the Steam site, their login form looks something like this.

<form name="logon" action="" method="POST">
    <div class="login_row">
        <div class="input_title">Steam account name</div>
        <input class="text_input" type="text" name="username" id="input_username" value="">
    </div>
    <div class="login_row">
        <div class="input_title">Password</div>
        <input class="text_input" type="password" name="password" id="input_password" autocomplete="off"/>
    </div>
</form>

And from that I gather you must supply 'username' and 'password' in your Post Request to 'http://store.steampowered.com/'.

After doing the post request, you could then use JSoup too tell if the login was successful based on the page result.

I hope this helps you. Feel free to comment any questions.

Community
  • 1
  • 1
Jonty Morris
  • 797
  • 1
  • 10
  • 25