Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to sign in #14

Open
rmangino opened this issue Feb 16, 2017 · 6 comments
Open

Unable to sign in #14

rmangino opened this issue Feb 16, 2017 · 6 comments

Comments

@rmangino
Copy link

I'm using v1.0.2 of this gem on macOS 10.12.3. My ruby version is: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15].

My test code:

require 'kindle_highlights'

kindle = KindleHighlights::Client.new(email_address: "[email protected]",
                                      password: "password")
puts kindle.books

I know my email address and password are correct because I'm copying and pasting the exact values I use when logging into amazon.com manually.

I'm receiving this error:

$ ruby kindle.rb
/Users/me/.rvm/gems/ruby-2.3.0/gems/kindle-highlights-1.0.2/lib/kindle_highlights/client.rb:55:in `conditionally_sign_in_to_amazon': Unable to sign in, received error: 'Enter a valid email or mobile number' (KindleHighlights::Client::AuthenticationError)
from /Users/me/.rvm/gems/ruby-2.3.0/gems/kindle-highlights-1.0.2/lib/kindle_highlights/client.rb:63:in `load_books_from_kindle_account'
from /Users/me/.rvm/gems/ruby-2.3.0/gems/kindle-highlights-1.0.2/lib/kindle_highlights/client.rb:16:in `books'
from kindle.rb:6:in `<main>'

I've tried passing different values for mechanize_options: { user_agent_alias: 'Mac Safari' } but I still recieve the same error.

Have you seen this issue before? TIA

@c01o
Copy link
Contributor

c01o commented Feb 21, 2017

Another one here.

gem: 1.0.2
ruby: 2.4.0p0 (2016-12-24 revision 57163) [x86_64-linux]
OS: Ubuntu 16.04 LTS

 /usr/local/bundle/gems/mechanize-2.7.5/lib/mechanize.rb:372:in `click': undefined method `[]' for nil:NilClass (NoMethodError)
 	from /usr/local/bundle/gems/kindle-highlights-1.0.2/lib/kindle_highlights/client.rb:66:in `load_books_from_kindle_account'
 	from /usr/local/bundle/gems/kindle-highlights-1.0.2/lib/kindle_highlights/client.rb:16:in `books'
 	from /kindle/scrape.rb:57:in `<main>'
 exited with code 1

It looks login problem, so I inspected the signin_page in client.rb:

    def conditionally_sign_in_to_amazon
      retries ||= 0

      if @kindle_logged_in_page.nil?
        signin_page            = mechanize_agent.get(KINDLE_LOGIN_PAGE)
        p signin_page
        signin_form            = signin_page.form(SIGNIN_FORM_IDENTIFIER)
        signin_form.email      = email_address
        signin_form.password   = password
        p signin_page
        post_signin_page       = mechanize_agent.submit(signin_form)
        p signin_page

      ...

and found that login failed although the form looks correctly got completed(email, password).

Try changing UserAgent to the same one of my browser made no effect.
mechanize_agent.user_agent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"

same issue found on stackoverflow: Using Mechanize to log into https://kindle.amazon.com/login

@speric
Copy link
Owner

speric commented Oct 7, 2017

I've experienced some sign-in related issues, but they are tough to debug. Are you still having issues here?

@speric
Copy link
Owner

speric commented Nov 10, 2017

It appears that Amazon has changed their Kindle Notes/Highlights site around, a lot. Since this gem assumes a certain structure as it crawls the Kindle site, it broke.

I am working on some fixes. Stay tuned!

@speric
Copy link
Owner

speric commented Nov 17, 2017

@rmangino @c01o I recommend upgrading to v2.0.0. of this gem. The Kindle page structure changed significantly, and it broke older versions.

@rkartzman
Copy link

@speric I'm on v2.0.1 and experiencing sign in issues. I don't get any errors, but it returns empty for my books array, even though I have confirmed that there are indeed books there. Any suggestions ?

@niyando
Copy link

niyando commented May 10, 2019

@rkartzman I am facing a similar issue. Were u able to resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants