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

Incorrect profile url calculation in GitHubAdapter #17

Description

@shabalin

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)
        ));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions