Accessing GitHub user data in Meteor client

October 20, 2013

Reading time ~1 minute

I recently wanted to get the accessToken from the accounts-github package in Meteor to use in my own package. After writing a post on StackOverflow I learned to perform the following steps to access all GitHub user data in my client side code.

This all requires you to have the accounts-github package added to your project:

meteor add accounts-github

Then you simply extend the profile object for Meteor.user() as follows in your server-side code.

So, when the user is created we add accessToken, email and username in the MongoDB database.

The user data will now be accessible from the client-side code using Meteor.user().profile.github.accessToken.