neo4j-javascript-driver: #The Client is unauthorized due to authentication failure
The client is unauthorized due to authentication failure.
-
Complete Error
- Neo4jError: The client is unauthorized due to authentication failure. at captureStacktrace (C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\node_modules\neo4j-driver\lib\result.js:277:15) at new Result (C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\node_modules\neo4j-driver\lib\result.js:68:19) at Session._run (C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\node_modules\neo4j-driver\lib\session.js:174:14) at Session.run (C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\node_modules\neo4j-driver\lib\session.js:135:19) at Object.executeCypherQuery (C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\middleware\graphDBConnect.js:16:34) at C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\routes\users.js:32:42 at newFn (C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\node_modules\express-async-errors\index.js:16:20) at Layer.handle [as handle_request] (C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\node_modules\express\lib\router\layer.js:95:5) at next (C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (C:\Users\sensei infotech\Desktop\hari\expressneo4jcrud\node_modules\express\lib\router\route.js:112:3)
-
My File Where i’m trying to login
const neo4j = require('neo4j-driver');
const config = require('config');
const uri = config.get('dbHost');
const user = config.get('dbUser');
const password = config.get('dbPass');
const driver = neo4j.driver(uri, neo4j.auth.basic(user, password), {
maxConnectionLifetime: 3 * 60 * 60 * 1000, // 3 hours
maxConnectionPoolSize: 50,
connectionAcquisitionTimeout: 2 * 60 * 1000, // 120 seconds
disableLosslessIntegers: true
});
const session = driver.session();
async function executeCypherQuery(statement, params = {}) {
try {
const result = await session.run(statement, params);
session.close();
return result;
} catch (error) {
throw error; // we are logging this error at the time of calling this method
}
}
module.exports = { executeCypherQuery };
I’m Using Default Username and Password username : neo4j password : neo4j
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (8 by maintainers)
@ddemydenko if the issue was about not overriding the default admin password AND assuming you’re using Docker, you can override the password with:
I’ve tried with a docker instance without set the password and got this:
So, It could be the case of change the password.
The docker run without change the password:
The docker run changing the password: