sybrenstuvel / flickrapi

Python Flickr API implementation
https://stuvel.eu/flickrapi
Other
155 stars 33 forks source link

flickr authentication error #127

Closed versus167 closed 2 years ago

versus167 commented 4 years ago

Hello!

I got with self.flickr.authenticate_via_browser(perms='delete')

`127.0.0.1 - - [18/Dec/2019 07:12:48] code 400, message Bad request version ('°\x07k')

127.0.0.1 - - [18/Dec/2019 07:12:48] "

do_request: Status code 401 received, content: oauth_problem=signature_invalid debug_sbs=POST https://www.flickr.com/services/oauth/request_token`

This works for years for me. I tested this with Firefox and Chrome as browser. My system ist ubuntu 18.04. Any idea what happen? A change on flickr or ubuntu?

versus167 commented 4 years ago

I switched now to (from https://stuvel.eu/flickrapi-doc/3-auth.html#authenticating-without-local-web-server

` self.flickr.get_request_token(oauth_callback='oob')

        # Open a browser at the authentication URL. Do this however
        # you want, as long as the user visits that URL.
        authorize_url = self.flickr.auth_url(perms='delete')
        webbrowser.open_new_tab(authorize_url)

        # Get the verifier code from the user. Do this however you
        # want, as long as the user gives the application the code.
        verifier = str(input('Verifier code: '))

        # Trade the request token for an access token
        self.flickr.get_access_token(verifier)

` And this works for me.

jim-easterbrook commented 4 years ago

I used to use this 'oob' authorization but switched to using a local server to avoid the hassle of copying the authorisation code from the browser to my application. Now I've started getting "SSL_ERROR_RX_RECORD_TOO_LONG" errors in Firefox. The solution seems to be to use a local HTTPS server instead of HTTP, using the Python ssl library to wrap the server socket. This gives loads of browser warnings as I'm using a self-signed certificate, but it does work.

To answer the original question, I think the change is Flickr changing the auth callback url from http to https.

jim-easterbrook commented 4 years ago

It appears other people have run into the same problem. I think Flickr are in the wrong here - if we wanted to use https we would have said so in our callback url. https://www.flickr.com/groups/api/discuss/72157712651258108/