This repository was archived by the owner on Apr 5, 2022. It is now read-only.

Description
I run into the issue that profile urls I see in UserConnection table are invalid, they look like: http://github.com/1233445
Github responds with 404 for such urls
I found that in GitHubAdapter.setConnectionValues user Id is used in ProfileUrl creation.
values.setProfileUrl("https://github.com/" + profile.getId());
As temporal workaround I overrided GitHubAdapter.setConnectionValues right in Java Config.
GitHubServiceProvider gitHubServiceProvider = new GitHubServiceProvider(env.getProperty("github.clientId"), env.getProperty("github.clientSecret"));
GitHubAdapter adapter = new GitHubAdapter() {
@Override
public void setConnectionValues(GitHub github, ConnectionValues values) {
GitHubUserProfile profile = github.userOperations().getUserProfile();
values.setProviderUserId(String.valueOf(profile.getId()));
values.setDisplayName(profile.getUsername());
values.setProfileUrl("https://github.com/" + profile.getUsername());
values.setImageUrl(profile.getProfileImageUrl());
}
};
registry.addAuthenticationService(new OAuth2AuthenticationService<>(
new OAuth2ConnectionFactory<>("github", gitHubServiceProvider, adapter)
));