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

Suggestion for SSO #258

Open
rflaperuta opened this issue Feb 11, 2021 · 4 comments
Open

Suggestion for SSO #258

rflaperuta opened this issue Feb 11, 2021 · 4 comments
Labels

Comments

@rflaperuta
Copy link

Recently I noticed that SSO in o'reilly wasn't able to access the profile page:

[#] Authentication issue: unable to access profile page.
[!] Aborting...
Then I added:

diff --git a/safaribooks.py b/safaribooks.py
index 26c9f62..1b121fb 100755
--- a/safaribooks.py
+++ b/safaribooks.py
@@ -522,6 +522,7 @@ class SafariBooks:
self.display.exit("Login: unable to reach Safari Books Online. Try again...")

     elif response.status_code != 200:
  •        self.display.error(response)
           self.display.exit("Authentication issue: unable to access profile page.")
    
       elif "user_type\":\"Expired" in response.text:
    

Leading me to:

[#] <Response [307]>
[#] Authentication issue: unable to access profile page.
[!] Aborting...
Changing the code as below allowed me to perform all operations.
Suggestion to allow redirects as per the above HTTP Response Code 307.

diff --git a/safaribooks.py b/safaribooks.py
index 26c9f62..a7b7b15 100755
--- a/safaribooks.py
+++ b/safaribooks.py
@@ -516,7 +516,7 @@ class SafariBooks:
self.display.exit("Login: unable to reach Safari Books Online. Try again...")

 def check_login(self):
  •    response = self.requests_provider(PROFILE_URL, perform_redirect=False)
    
  •    response = self.requests_provider(PROFILE_URL, perform_redirect=True)
    
       if response == 0:
           self.display.exit("Login: unable to reach Safari Books Online. Try again...")
    

Another detail, it would be really nice to know what went wrong, perhaps a debug mode or more detailed error messages....

@ufolux
Copy link

ufolux commented Mar 5, 2021

This really helps me! Maybe you could submit a merge request to fix this issue? @rflaperuta

@akitathai94
Copy link

are you fixing it by change default value of redirect to True? I am trying but still got error

@alvamich
Copy link

i cloned 21 of may safaribooks.py changed the value to true. and it worked.
response = self.requests_provider(PROFILE_URL, perform_redirect=True)
tx. I believe it should be merge to the branch.

@sophin123
Copy link

As I was having the same issue login in using SSO. I try to change the boolean variable and it didn't work for me. So what I did instead was, first I logged in using SSO and then opened the books and copy the ID from the URL and then apply the following code by just typing ID only.

python safaribooks.py --cred "" 9781491958698

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

No branches or pull requests

6 participants