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

Add support for Amazon's "Verification Needed" page at login #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/kindle_highlights/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module KindleHighlights
class Client
class CaptchaError < StandardError; end
class AuthenticationError < StandardError; end
class ConfirmationError < StandardError; end
class AsinNotFoundError < StandardError; end

SIGNIN_FORM_IDENTIFIER = "signIn"
Expand Down Expand Up @@ -72,6 +73,9 @@ def conditionally_sign_in_to_amazon
elsif post_signin_page.search("#message_error > p").any?
amazon_error = post_signin_page.search("#message_error > p").children.first.to_s.strip
raise AuthenticationError, "Unable to sign in, received error: '#{amazon_error}'"
elsif post_signin_page.title == "Please confirm your identity"
confirmation_url = post_signin_page.uri.to_s
raise ConfirmationError, "Received a confirmation request while attempting to sign in to your Amazon account. You will need to resolve this manually at #{confirmation_url}"
else
@kindle_logged_in_page = post_signin_page
end
Expand Down