guznik/spring-social-google — Issue #4: GoogleConnectionFactory#extractProviderUserId returns null
Author: Gorbas
Created: 2012-02-25 15:38:43+00:00
State: open

The GoogleConnectionFactory does not override the "extractProviderUserId" method, which means that the factory does not return the UserId (username) of the connected user.

I personally added the following to the GoogleConnectionFactory class:

@Override
protected String extractProviderUserId(AccessGrant accessGrant) {
Google api=((GoogleServiceProvider)getServiceProvider()).getApi(accessGrant.getAccessToken());
UserProfile userProfile=getApiAdapter().fetchUserProfile(api);
return userProfile.getUsername();
}