Search code examples
authenticationmeteoriron-router

How to do Google Sign-In in Meteor


I've tried various tutorials and links on how to get Google Sign-In to work in Meteor to no avail. How can I create a google sign in button on my login page that redirects to my user dashboard--using iron:router perhaps (and shows the persons name in the corner), and restrict the google emails to only .edu accounts?

Also as the admin of the page how would I be able to see the emails/names of all the people who have logged into my website? Is this done through Google Analytics?


Solution

    • For Google Sign-in, I would recommend installing the accounts-entry package and configuring it from your browser:

      install with latest meteor version

      meteor add joshowens:accounts-entry

      and for meteor version before 0.9 use

      mrt add accounts-entry

    • For your dashboard redirection, review the documentation for that package on atmospherejs.com which demonstrates how to configure your dashboardRoute:

      dashboardRoute: '/dashboard'

    • The iron-router package is a dependency of accounts-entry, so it will be installed as well.

    • Access the data by launching the MongoDB shell (after starting your app):

      meteor mongo

    • Query for the accounts using the MongoDB shell:

      db.users.find()

    • This is not handled via Google Analytics