Connect Neo.ClientError.Security.Unauthorized: The client is unauthorized due to authentication failure

hi
I installed recently neo4j browser
I typed "bolt://localhost:7687 as a connect URL", "neo4j" as user and "neo4j" as psw but I faced this error msg " Neo.ClientError.Security.Unauthorized: The client is unauthorized due to authentication failure." what should I do please

what version of Neo4j?
Have you previously connected with username: neo4j. did you change this users password?
For native Neo4j Authentication, users and roles are recorded in data/dbms/auth and data/dbms/roles respectively. If you do not know the neo4j usernames password you can remove data/dbms/auth, restart Neo4j and the default password is neo4j

5 Likes

@dana_canzano,

Upgraded to ver 4 last night. I was stuck on "Neo.ClientError.Security.Unauthorized: The client is unauthorized due to authentication failure." and came across your above reply. Removed auth file and re-start Neo4j no success then removed roles file as will stopped the db, re-started my pc. No if I try with Atuth type User/password with neo4j as user and password I am getting "Neo.ClientError.Security.Unauthorized: The client is unauthorized due to authentication failure." And If try Auth type No Authentication I am getting "Neo.ClientError.Security.Unauthorized: Unsupported authentication token, missing key scheme: { user_agent='neo4j-javascript/0.0.0-dev' }".

I'm not sure if I can resolve this my myself. Need some guidance to proceed.

Thanks.

I ran into the same issue, except this was a clean install.

I used the neo4j-admin set-initial-password before I logged in for the first time.
Password was never accepted.

The only workaround for me was to delete the database, and the auth file, restart the service, and log in using neo4j/neo4j and change password when prompted. Obviously this doesn't help you with an "upgrade" ...

1 Like

I'm having the same issue after upgrading to 4.0. Is there an alternative solution other than deleting the database?

Hello,

In 4.0 we have a specific password recovery procedure, you can find it in the product documentation.

Kind regards,

1 Like

Was able to solve the password issue from Neo4j 4.0 browser, providing the default password requires immediate password change and DB was successfully updated.

$ neo4j-admin set-initial-password <new_pw>

^ weird that this ran successfully, but then could not authenticate in UI. However, the default neo4j pw string did work...

1 Like

Password change via Neo4j Browser must be changed on node having "LEADER" role which will be synced to all other members, you can check the role via Cypher Shell:

$ /app/neo4j-enterprise-4.0.0/bin/cypher-shell -a "hostname"
Connected to Neo4j 4.0.0 at neo4j://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j@neo4j> CALL dbms.cluster.role("neo4j");
+----------+
| role |
+----------+
| "LEADER" |
+----------+

1 row available after 11 ms, consumed after another 1 ms
neo4j@neo4j>

neo4j-admin set-initial-password will no longer work in 4.0.

Indeed, you can use the default password to log in the first time.
If you forget it, please follow the new recovery procedure.

Kind regards,

Hi
I've do that but I've this error

ALTER USER neo4j SET PASSWORD 'neo4j';
Unsupported administration command: ALTER USER neo4j SET PASSWORD 'neo4j';

this totally saved my life, i had changed the password with set initial password but it took the default neo4j password via cypher shell

Had the same problem just a few hours ago. To solve this problem:

  1. Open neo4j browser from Neo4j desktop
  2. Use ":server user add" command to create new user
  3. Check the "Force password change" option
  4. Open common browser (chrome, firefox, etc) at http://localhost:7474/
  5. Login with the user you have created.
  6. Set a new password for the user
  7. Smile :slight_smile:
3 Likes

My version is Community 4.0.4.

@pdrangeid I had the same issue with a clean re-install and can't log in with the initial default neo4j/neo4j credentials. My setting is below:
dbms.security.auth_enabled=true

Since it's a new install, how did you delete the 'auth file'? There is no such a file before you are able to log into it.

The initial password neo4j/neo4j didn't work in my browser, but fortunatelly it worked at the cypher-shell command line for me. Sometimes it worked at the browser. It's strange. It seems it hasn't been a clear answer to this issue yet.

Hello sir, i am facing the same problem, do you suggest to delete the auth file from C:\Users\sitas\AppData\Local\Neo4j\Relate\Data\dbmss\dbms-cc0c3c9f-17a7-4208-8fd3-adf370d517e2\data\dbms1.1

this file?

Had the same issue with NodeJS driver, on Neo4j version 4.2.1+. I couldn't connect to my local instance as the default admin user via the driver. The solution was to create a new user (same roles as default admin user) and it worked.

I am getting an error when I try to connect with NodeJS driver on Neo4j version 4.3.3 with username displayed and password I created. I get the the error code Neo.ClientError.Security.Unauthorized,
I am able to connect from Neo4j Browser. I tried resetting password and I get same error. I tried creating a new user as suggested and I am still seeing the same error.

Hello Guys,

Currently, am facing this issue. Do you all think that is this related to password..?
Because my error msg is as follows:
neo4j.exceptions.AuthError: {code: Neo.ClientError.Security.Unauthorized} {message: The client is unauthorized due to authentication failure.}

After a first install of Neo4j Desktop, I was trying to connect to local Neo4j DBMS from a local Node.js app and I was faced with the exact same issue and solved it in the following way:

  • Go to the Neo4j Desktop UI and select the DBMS that is currently running (e.g. Movie DBMS)

  • On the right-hand panel, click on the "Reset DBMS password" option and reset your password there, after which this DBMS will restart automatically

  • After doing the above two steps and having updated the variable (i.e. NEO4J_PASSWORD) in the .env file of my local Node.js app accordingly, then restarted the Node.js app and now it connects to the local Neo4j DBMS successfully!