Spring Social: "Unable to get a ConnectionRepository: no user signed in" Spring Social: "Unable to get a ConnectionRepository: no user signed in" spring spring

Spring Social: "Unable to get a ConnectionRepository: no user signed in"


Social Connection should be correspond to any auth user. It seems user should login through username/password or Service Provider. Try look at http://docs.spring.io/spring-social/docs/1.0.x/reference/html/signin.html

"java.lang.IllegalStateException: Unable to get a ConnectionRepository: no user signed in"

It happens because AuthenticationNameUserIdSource used by default

Internally, Spring Social’s configuration support will use the UsersConnectionRepository to create a request-scoped ConnectionRepository bean. In doing so, it must identify the current user. Therefore, we must also override the getUserIdSource() to return an instance of a UserIdSource.

In this case, we’re returning an instance of AuthenticationNameUserIdSource. This implementation of the UserIdSource interface assumes that the application is secured with Spring Security. It uses the SecurityContextHolder to lookup a SecurityContext, and from that return the name property of the Authentication object.

If your application isn’t secured with Spring Security, you’ll need to implement the UserIdSource interface as approprate for your application’s security mechanism. The UserIdSource interface looks like this:

package org.springframework.social;public interface UserIdSource {    String getUserId();}

The getUserId() method simply returns a String that uniquely identifies the current user.

More info here


If you are using Spring boot, then the property security basic should not be set to false. Hide this line in your application.properties. This disables the security and boot throws the error if spring-security is disabled.

#security.basic.enabled=false