Search code examples
springspring-securityspring-cloud-config

Bad credential with Spring Cloud Config server when security is enable


I create a Spring Cloud Config server. I put security in my application.properties file

security.basic.enabled=false
security.user.name=1user
security.user.password=123

When I try to log to the application with the name and password, I always get

Bad credentials

I tried to put enabled to true but get same result. I saw in the command line then spring generate random password like

69dfeb52-6320-4085-bcd1-22ee7a3676a2

if I use with with username user, I can connect.


Solution

  • >

    Hi Robert Trudel

    If you are using Spring Boot 2.x, then you need to prefix these properties with spring as shown below:

    spring.security.user.name=1user
    spring.security.user.password=123
    

    Also, you do not need this security.basic.enabled=false.

    Hope this helps!