Search code examples
javascriptmeteoroauthauthorizationmeteor-accounts

How to Determine Type of Login that User Used in Meteor?


I am looking for the best way to determine type of service that user used to login into the system. I mean something like Meteor.user().typeOfLogin() that will return e.g('facebook', 'google', 'password')... or at least maybe someone know the reliable way how to manually check it.

I looked at official docs but I didn't find anything useful: http://guide.meteor.com/accounts.html


Solution

  • You need to have underscore added in your project.

    Meteor.users.helpers({
        typeOfLogin: function() {
                if (_.has(this.services, 'facebook'))
                    return 'facebook';
                if (_.has(this.services, 'google'))
                     return 'google';
            }
    });