safaribooks icon indicating copy to clipboard operation
safaribooks copied to clipboard

Suggestion for SSO

Open rflaperuta opened this issue 4 years ago • 4 comments

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....

rflaperuta avatar Feb 11 '21 14:02 rflaperuta

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

ufolux avatar Mar 05 '21 06:03 ufolux

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

akitathai94 avatar Mar 06 '21 00:03 akitathai94

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.

alvamich avatar Jun 21 '21 20:06 alvamich

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

sophin123 avatar Aug 06 '21 06:08 sophin123