meteorgithubaccounts

meteor accounts-github pkg does not display username after logging in


I have the following packages installed in my meteor app:

accounts-github 1.3.0
accounts-password 1.4.0
accounts-ui 1.1.9
github-config-ui 1.0.0

I display the login menu using {{> loginButtons}}

If I log in using a standard username and password it correctly displays the username after logging in. If I log in using github, it successfully logs me in but it doesn't display any username. The only thing that appears is the drop down arrow. Clicking that shows the sign out button.

This is my accounts config code.

Accounts.ui.config({
passwordSignupFields: "USERNAME_AND_EMAIL"
});

Solution

  • If you need the user.username field to be the Github username from the field user.services.github.username. You can do it inside the onCreateUser function.

     Accounts.onCreateUser((options, user) => {
        user.profile = options.profile;
    
        // If signed in with github
        if (user.services.github) {
            user.username = user.services.github.username
        }
    
        return user;
     });
    

    This code should be server side and not inside Meteor.startup().