Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth error: User not authorized #1

Open
evgeni-lh opened this issue Feb 1, 2024 · 1 comment
Open

Auth error: User not authorized #1

evgeni-lh opened this issue Feb 1, 2024 · 1 comment

Comments

@evgeni-lh
Copy link

evgeni-lh commented Feb 1, 2024

Hi,
I am using Ubuntu 22.04.3 LTS, Neo4j 5.14.0 community edition and successfully installed the cypher-workbench as described in the video:
install cypher-workbench

User: admin, Password: i*****01
I managed to login into the cypher-workbench and work with the tool for some time, then some error appeared when trying to reconnect to a neo4j db and I closed the tab. Afterwards I tried to login again (api and ui running) at
http://localhost:3000/login
but this time I got the error: Auth error: User not authorized

I tried:

  1. Restarting Neo4J and cypher-workbench multiple times --> same error
  2. Removing the installation of cypher-workbench and reinstalled --> same error

Btw after having search a bit through the internet I game across this stackoverflow same error. Could it be somehow related to our case?

Thank you very much!
PS: The tool is really amazing, I was able to work for 2 hours before started to get the above error :)

@ericmonk
Copy link
Collaborator

Sorry it took so long to respond to this issue. Let me provide some information and troubleshooting instructions.

Perhaps the first thing you can try is to reset the admin password. Run the following under the /api folder:

npm run createUser Neo4j admin neo4j "Workspace Admin" "admin"

replacing the lowercase neo4j with your password

This would fix the issue if you had logged in, and then changed the value of ENCRYPTION_KEY but didn't run these instructions: Updating admin user password after encryption key change

If that doesn't fix the issue, here are some more detailed troubleshooting instructions:

Note that the username/password for the Neo4j database is not the same password for logging into Cypher Workbench. The Neo4j database password is specified in the .env file under the /api folder using NEO4J_USER and NEO4J_PASSWORD

The Cypher Workbench username / password is stored in a User node inside the Neo4j database you have configured using NEO4J_URI and NEO4J_DATABASE also in the .env file.

  1. Connect with Neo4j Browser (http://localhost:7474/browser) using the credentials stored in the .env file (replace http://localhost:7474 with the value of NEO4J_URI
  2. Run :use DatabaseName where DatabaseName is the value of NEO4J_DATABASE
  3. Run the following Cypher Query to list the User nodes:

MATCH (u:User) RETURN u.email, u.encryptedPassword, u.primaryOrganization

You will see something like this:

u.email u.encryptedPassword u.primaryOrganization
"admin" "U2FsdGVkX1+cHBWHPnQy9qIxAHKHCQXmfjeLtbWv30Y=" "Neo4j"

The value of u.email is what you use to login to Workbench. It should be admin in your case, if you haven't added additional users.

  1. Next, let's reset the password.
  2. In the /api folder, run this command:

npm run encryptV1 <password>

where <password> is the password you want to use. It will print out a long string that most likely will end with an equals = sign.

  1. Copy this value and run the following statement in Neo4j Browser:

MATCH (u:User {email:'admin'}) SET u.encryptedPassword = '<encrypted-password>'

Replacing <encrypted-password> with the value you got from running the encryptV1 command.

At this point, you should now be able to login with admin and the new password you chose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants