0

I worked through this example provided online: http://www.mkyong.com/java/how-to-automate-login-a-website-java-example/ and successfully programmatically logged into my gmail. this tutorial's method was to send a get request of the sign-in page, send a post request to submit the login information, and then send another get request to see the gmail page. the session is maintained throughout.

however, when i tried to programmatically log into amazon (via get, post, then get again to a profile-specific page), the session is not maintained. after sending the post request, i send a get request to the shopping cart page in hopes of getting my profile's shopping cart. i am redirected to the sign in page instead.

i've read online that in order to maintain the session, cookies need to be sent to the next get request. i did pretty much the exact same thing as instructed in the tutorial, except for amazon, and it does not work though.

can anyone explain why the session is not being maintained for amazon, but is for gmail?

thanks in advance!

Bethany
  • 63
  • 3
  • 11

1 Answers1

0

It is tough to answer this question without more detail on the specifics, and/or seeing the code being used. That said, the issue you describe does sound like a cookie issue since that is what is generally used to maintain web application state.

As I see it, there are four possibilities:

  1. You are not correctly retrieving and setting the cookie necessary to maintain a session with Amazon.
  2. The login is failing, so no cookie is even sent or set, and thus this is the reason the login page is being returned again.
  3. The url you are attempting to access with your failing get includes a CSRF token which you are not correctly parsing from a prior page.
  4. Other technical issues to do with session management are not being met (perhaps cross domain related issues, or perhaps Amazon has implemented protections to prevent automated access).
Trevor Freeman
  • 7,112
  • 2
  • 21
  • 40