Error [401]: Unauthorized. No permission -- see authorization schemes. Authorization Required
nikolasd opened this issue · comments
It seems that when you need authorization to access the neo4j you get the following error.
I guest the error is happening because the user credentials are not passed when connecting to db.
I did a small hack to bypass this error by changing line 495 of neo4django.utils from conn = Client('http://%s:%d/db/data' % (db['HOST'], db['PORT']), **db['OPTIONS'])
to conn = Client('http://%s:%d/db/data' % (db['HOST'], db['PORT']), **{'username': db['USER'], 'password': db['PASSWORD']}
and also uncommented lines 485 and 486, until a better solution is found.
@nikolasd we've had auth support for a while- why not just set 'username' and 'password' in the 'OPTIONS' dict in settings, as intended? That's why the **db['OPTIONS']
bit is there.
Maybe you could help improve the docs?
Sorry if I'm being a bit dumb, but how is this supposed to be done?
I've tried adding
'OPTIONS': {
'USERNAME': 'my username',
'PASSWORD': 'my password'
}
to the NEO4J_DATABASES dictionary, but I get:
File "......./neo4django/neo4django/neo4jclient.py", line 30, in __init__
super(EnhancedGraphDatabase, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'PASSWORD'
try
'username': 'lorem',
'password': 'ipsum',
It worked for me when I included it in my HOST in the settings.py module.
'HOST':'username:password@localhost',