Skip to content

Commit

Permalink
fix: fix login issues on brazilian marketplace (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkb79 authored Sep 27, 2023
1 parent 60a591b commit 59a1c92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

-

## [0.9.1] - 2023-09-27

## Bugfix

- Fix login issues on brazilian marketplace.

## [0.9.0] - 2023-09-27

## Bugfix
Expand Down
13 changes: 11 additions & 2 deletions src/audible/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,21 @@ def login(

session.close()

if b"openid.oa2.authorization_code" not in login_resp.url.query:
url = None
if b"openid.oa2.authorization_code" in login_resp.url.query:
url = login_resp.url
elif len(login_resp.history) > 0:
for history in login_resp.history:
if b"openid.oa2.authorization_code" in history.url.query:
url = history.url
break

if url is None:
raise Exception("Login failed. Please check the log.")

logger.debug("Login confirmed for %s", username)

authorization_code = extract_code_from_url(login_resp.url)
authorization_code = extract_code_from_url(url)

return {
"authorization_code": authorization_code,
Expand Down

0 comments on commit 59a1c92

Please sign in to comment.