flickrapi icon indicating copy to clipboard operation
flickrapi copied to clipboard

Code 401 signature_invalid during authentication

Open sergio-ns opened this issue 5 months ago • 1 comments

As I was getting errors while running my python photo-uploader after not using if for a few weeks, I went on to request a new api key/secret pair which I'm now trying to authenticate, but the authentication fails while calling: flickr.get_request_token(oauth_callback='oob')

with error:

do_request: Status code 401 received, content:
    oauth_problem=signature_invalid
    debug_sbs=POST
    https://www.flickr.com/services/oauth/request_token
 oauth_callback=oob&oauth_consumer_key=<MY_API_KEY>&oauth_nonce=<NONCE>8&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1706650918&oauth_version=1.0
Traceback (most recent call last):
  File "D:\python-flickr\auth.py", line 8, in <module>
    flickr.get_request_token(oauth_callback='oob')
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flickrapi\core.py", line 641, in get_request_token
    self.flickr_oauth.get_request_token(oauth_callback=oauth_callback)
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flickrapi\auth.py", line 367, in get_request_token
    token_data = self.do_request(self.REQUEST_TOKEN_URL, params)
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\flickrapi\auth.py", line 262, in do_request
    raise exceptions.FlickrError('do_request: Status code %s received' % req.status_code)
flickrapi.exceptions.FlickrError: do_request: Status code 401 received

here's the authentication script's code:

import flickrapi
import webbrowser
api_key  =
api_secret =  
flickr = flickrapi.FlickrAPI(api_key, api_secret, format='parsed-json')
flickr.get_request_token(oauth_callback='oob')
authorize_url = flickr.auth_url(perms='delete')
webbrowser.open_new_tab(authorize_url)
verifier = str(input('Verifier code: '))
flickr.get_access_token(verifier)

I'm on python 3.10.11 on Windows.

Something must have changed in the whole process and I have probably missed a memo Any clue? Thanks

sergio-ns avatar Jan 30 '24 21:01 sergio-ns