Question

I'm trying to enable "User-Restricted Resource Access" in my eve application with Basic Authentication. http://python-eve.org/authentication.html#user-restricted-resource-access

The Problem is since I enabled it I get for every http request on the API a "500 error"

If I fire up the API without basic authentication params I get a bad credentials error, so the Basic Authentication works fine.

This is the eve DEBUG Output:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/Eve-0.3-py2.7.egg/eve/methods/common.py", line 226, in rate_limited
    return f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/Eve-0.3-py2.7.egg/eve/auth.py", line 43, in decorated
    if not auth.authorized(roles, resource_name, request.method):
  File "/usr/local/lib/python2.7/dist-packages/Eve-0.3-py2.7.egg/eve/auth.py", line 97, in authorized
    allowed_roles, resource, method)
  **File "/home/maanuel/emberv/eve/run.py", line 12, in check_auth
    self.set_request_auth_value(account['_id'])
AttributeError: 'BCryptAuth' object has no attribute 'set_request_auth_value'**

It seems like the set_request_auth_class is missing

I'm using eve 0.3 installed with easy_install

Was it helpful?

Solution

You are reading the documentation about the development version (as stated on all pages at python-eve.org.) One relevant change coming with v0.4 is the way auth tokens are set. So basically, you are applying 0.4-dev syntax to Eve v0.3. You should probably follow these instructions instead.

PS: 0.4 is due for release real soon so you might want to stick with that one, so you don't have to update your code again soon.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top