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.

The client is unauthorized due to authentication in my Spring Boot Test

sngermiyanoglu
Node Clone

Hi,

I have a problem about running any test of AppApplicationTests.

When I run with docker and try any request, I cannot have any issue.

org.neo4j.driver.exceptions.AuthenticationException: The client is unauthorized due to authentication failure.

How can I fix this codes snippet shown below.

@DynamicPropertySource
static void properties(DynamicPropertyRegistry registry) {
registry.add("spring.neo4j.authentication.username", () -> "neo4j");
registry.add("spring.neo4j.authentication.password", () -> "123456");
registry.add("spring.neo4j.uri", () -> container.getBoltUrl());
}

Here is my repository : Project Link 

1 ACCEPTED SOLUTION

Here is the solution

The issue disappeared when the password changed to ``````container.getAdminPassword()``

 

@DynamicPropertySource
static void properties(DynamicPropertyRegistry registry) {
    registry.add("spring.neo4j.authentication.username", () -> "neo4j");
    registry.add("spring.neo4j.authentication.password", () -> container.getAdminPassword());
    registry.add("spring.neo4j.uri", () -> container.getBoltUrl());
}

 

View solution in original post

1 REPLY 1

Here is the solution

The issue disappeared when the password changed to ``````container.getAdminPassword()``

 

@DynamicPropertySource
static void properties(DynamicPropertyRegistry registry) {
    registry.add("spring.neo4j.authentication.username", () -> "neo4j");
    registry.add("spring.neo4j.authentication.password", () -> container.getAdminPassword());
    registry.add("spring.neo4j.uri", () -> container.getBoltUrl());
}