cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Python - Neo4j Failed to Connect but Scala Success

Same Connection (url, user and password) success when try using Scala. Unfortunately failed when using python with neo4j driver.

Python : Failed
driver = GraphDatabase.driver("bolt://127.0.0.1:7687", basic_auth={"neo4j","password"})

Scala : Success
val driver = GraphDatabase.driver("bolt://127.0.0.1:7687", AuthTokens.basic("neo4j","password"))

I got the following error using python :
neobolt.exceptions.AuthError: Unsupported authentication token, missing key scheme
Failed to write data to connection Address(host='127.0.0.1', port=7687) (Address(host='127.0.0.1', port=7687)); ("0; 'Underlying socket connection gone (_ssl.c:2067)'")

Any suggest how to solve this ?

Thank you

3 REPLIES 3

Hi
Did you manage to solve this?
The docs I've read suggest using auth=("neo4j",whatever_your_passsword_is_in_quotes) not basic_auth as you have here.
However - whenever I try this I get
neobolt.exceptions.AuthError: The client is unauthorized due to authentication failure.

Cheers
Guy

Same here.

I tried all variants of

NEO4J_URI = "bolt://localhost:7687"
# NEO4J_URI = "bolt://127.0.0.1:7687"

# driver = GraphDatabase.driver(NEO4J_URI, auth=("neo4j", "neo4j"))
# driver = GraphDatabase.driver(NEO4J_URI, auth=("neo4j", "password"))
driver = GraphDatabase.driver(NEO4J_URI)

Exception is:

  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\work\simple.py", line 221, in run
    self._connect(self._config.default_access_mode, database=self._config.database)
  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\work\simple.py", line 118, in _connect
    self._connection = self._pool.acquire(
  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\io\__init__.py", line 805, in acquire
    return self._acquire(self.address, timeout)
  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\io\__init__.py", line 660, in _acquire
    connection = self.opener(address, timeout)
  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\io\__init__.py", line 787, in opener
    return Bolt.open(
  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\io\__init__.py", line 340, in open
    connection.hello()
  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\io\_bolt4.py", line 98, in hello
    self.fetch_all()
  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\io\__init__.py", line 517, in fetch_all
    detail_delta, summary_delta = self.fetch_message()
  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\io\_bolt4.py", line 271, in fetch_message
    response.on_failure(summary_metadata or {})
  File "C:\bright\git\python\neo4j-architecture\src\venv\lib\site-packages\neo4j\io\_common.py", line 202, in on_failure
    raise AuthError(message)
neo4j.exceptions.AuthError: {code: None} {message: None}

in log file:

2021-06-08 08:22:08.322+0000 WARN  Unsupported authentication token, missing key `scheme`: { user_agent='neo4j-python/4.3.1 Python/3.8.10-final-0 (win32)' }
2021-06-08 08:26:57.582+0000 WARN  The client is unauthorized due to authentication failure.

same with python 3.9

2021-06-08 07:25:00.201+0000 WARN  Unsupported authentication token, missing key `scheme`: { user_agent='neo4j-python/4.3.1 Python/3.9.0-final-0 (win32)' }
2021-06-08 07:28:09.631+0000 WARN  The client is unauthorized due to authentication failure.

I even get this error when I disable authentication
i.e.

# Whether requests to Neo4j are authenticated.
# To disable authentication, uncomment this line
# dbms.security.auth_enabled=true

Anybody any idea why this could happen?