Adding Google Login Support to Wekan Or, My First Experience Forking a Repo

I love Kanban tools, they are so simple yet so useful. Up until now I was typically using Trello, but for two main reasons I am moving on to the open source alternative WeKan: domain login, and account creation.

I want to use a Kanban tool inside Matsuri, but making everyone create an account on Trello is a bad idea: at least one person won't do it. We recently started using Google Apps for Work, and everyone is allocated a personal email, so it made much more sense to me to use OAuth. Enter Project GACKT, or Google Apps Connected Kanban Tool. I like my puns.

On the WeKan issues page, there was some discussion regarding OAuth but it doesn't look like much attention is given to it. One discussion mentioned "simply" adding the accounts-google Meteor package.

As it turns out it wasn't that simple in my case. Enter my first experience forking a repository. First, after enabling accounts-google I disabled accounts-password since I only want Google Apps login. However doing so will break...a lot of things. I rewrote config\accounts.js to only use the signIn route, and to remove anything pertaining to regular account creation. I also took this opportunity to restrict logins to accounts, and for good measure add some error messages.

Next, models\users.js seems to populate some profile fields automatically, but since I removed account creation those fields remain empty. To fix that, I removed the autoValue() properties in username and some profile fields, and instead used the Accounts.onCreateUser call to populate those fields from the Google profile when my users first log in. I put all of that, along with the necessary Google service configurations in server\lib\config\accounts.js.

Finally, I removed the ability to edit profiles since it made more sense in my use case. I guess I did okay despite having absolutely zero experience with Meteor?