I have added token based authentication to eureka but whenever it is calling /eureka/peerreplication/batch/ it is not associated with any authentication and not header passed so I’m getting 401 unauthorised causing some issues in the application while registering eureka client.

I’m using spring-cloud-starter-Netflix-eureka-server to latest jar. Also jersey-apache-client4 of 1.19.4.

I have also tried to add customised headers to the method by overriding but still it’s not working.

Please resolve this as it does not have solution over the internet.

Comment From: OlgaMaciaszek

Hello @kambapk, thanks for creating the issue. Please provide a minimal, complete, verifiable example that reproduces the issue.

Comment From: kambapk

I have one discovery server and config server running on HTTPS without any authentication now I have two ways to add authentication one is username password based authentication where I can add username and password in eureka url While registering with eureke which is not safe as I’m exposing password. And Second way is to add token based authentication where I can create token internally using required permission and I will pass that token ever client trying to register with eureka using Bean of DiscoveryClient.DiscoyClientOptionalArgs discoveryclientOptionalArgs() method in which I will add token to request header. But for multiple eureka nodes where peer to peer connection causing the issue for the same. Only solution is to use username password authentication which is not safe and token based authentication not working

Comment From: OlgaMaciaszek

@kambapk In order for us to verify it, please provide a sample app as a link to a separate GH repo with a small executable app or tests.

Comment From: spring-cloud-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: kambapk

There are some custom token genartion utility that I can not upload here. You just need to create a discovery server config server and add token based authentication when multiple discovery server runs and config server connected both them you will face the issue. Note- username password based authentication works fine but we don’t need to that for security reasons

Comment From: OlgaMaciaszek

. You just need to create a discovery server config server and add token based authentication when multiple discovery server runs and config server connected both them

Please just prepare it as a sample and link repo. You can put any token you create, not your custom token - just whatever is necessary to reproduce the issue.