Skip to content

add support for two step authentication#1

Open
swiftster wants to merge 2 commits intoJaffa:masterfrom
swiftster:2fa
Open

add support for two step authentication#1
swiftster wants to merge 2 commits intoJaffa:masterfrom
swiftster:2fa

Conversation

@swiftster
Copy link
Copy Markdown

Authentication currently breaks if user has two-step authentication enabled (like i do). This detects if user was redirected to the /ap/mfa page and prompts user for a 2FA code.

Copy link
Copy Markdown
Owner

@Jaffa Jaffa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this - and sorry for the delay in getting to it (the GitHub notification got buried, but that's no excuse)!

Comment thread amazonmusic.py Outdated

if r.history and r.history[-1].is_redirect and AMAZON_MFA in r.history[-1].headers['Location']:
soup = BeautifulSoup(r.content, "html.parser")
query = {"otpCode": input("2FA Code:")}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the library may be used through an app, or a voice interface, I think this will need to be pulled into an optional callout when constructing the AmazonMusic object.

Copy link
Copy Markdown

@danieldaeschle danieldaeschle May 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes i think so too.
A better solution is to provide a callback like this:

from amazonmusic import AmazonMusic

am = AmazonMusic()


@am.two_factor
def two_factor(authorize):
    code = input('2FA Code: ')
    authorize(code)

@danieldaeschle
Copy link
Copy Markdown

@swiftster please check my suggestion.

@adamprato
Copy link
Copy Markdown

This would be nice to have :)

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

Successfully merging this pull request may close these issues.

4 participants