omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

"'User' object is not callable." issue. #895

Closed alexpantyukhin closed 8 years ago

alexpantyukhin commented 8 years ago

Hi! I have a problem now with social auth when I try to link the current logined account with some social network. I use flask with sqlalchemy. The same problem are repeated on the example app https://github.com/omab/python-social-auth/tree/master/examples/flask_example

Use case:

Traceback (most recent call last):
  File "/home/alex/.virtualenvs/pyth_social_auth_example/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/alex/.virtualenvs/pyth_social_auth_example/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/alex/.virtualenvs/pyth_social_auth_example/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/alex/.virtualenvs/pyth_social_auth_example/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/alex/.virtualenvs/pyth_social_auth_example/lib/python2.7/site-packages/flask/app.py", line 1478, in full_dispatch_request
    response = self.make_response(rv)
  File "/home/alex/.virtualenvs/pyth_social_auth_example/lib/python2.7/site-packages/flask/app.py", line 1577, in make_response
    rv = self.response_class.force_type(rv, request.environ)
  File "/home/alex/.virtualenvs/pyth_social_auth_example/lib/python2.7/site-packages/werkzeug/wrappers.py", line 847, in force_type
    response = BaseResponse(*_run_wsgi_app(response, environ))
  File "/home/alex/.virtualenvs/pyth_social_auth_example/lib/python2.7/site-packages/werkzeug/test.py", line 871, in run_wsgi_app
    app_rv = app(environ, start_response)
  File "/home/alex/.virtualenvs/pyth_social_auth_example/lib/python2.7/site-packages/werkzeug/local.py", line 371, in <lambda>
    __call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
TypeError: 'User' object is not callable
alexpantyukhin commented 8 years ago

I found what was the problem. It seems that the do_complete function tried to get current_user object which was a proxy. That was the reason why it was not 'callable'