我能够通过以下教程实现OAUTH并登录到我的OAUTH应用程序一次:
https://pythonspot.com/login-to-flask-app-with-twitter/
但是,尝试再次登录后,我收到401响应和一条消息:
{'缺少请求令牌':''}
在执行此操作之前,它会重定向到Twitter,该Twitter显示一条消息,指出它正在重定向到该站点,然后崩溃。崩溃前显示的网址如下:
https://api.twitter.com/oauth/authenticate?oauth_token=[my_oauth_token]
然后它在重定向时崩溃,出现在如下所示的URL:
我试图在我的oauth_authorized函数中设置一个断点,但是却没有成功。只是陷入装饰器的过程中。
感谢您的帮助,因为它确实可以工作一次,我不确定为什么它仍然会失败。感谢您的指导!
错误的堆栈跟踪:
Traceback (most recent call last):
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\app.py", line 2463, in __call__
return self.wsgi_app(environ, start_response)
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\app.py", line 2449, in wsgi_app
response = self.handle_exception(e)
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\_compat.py", line 39, in reraise
raise value
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask_oauth.py", line 432, in decorated
data = self.handle_oauth1_response()
File "C:\Users\nuvio\AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask_oauth.py", line 384, in handle_oauth1_response
type='invalid_response', data=data)
flask_oauth.OAuthException: <unprintable OAuthException object>