kahmali / meteor-restivus

REST APIs for the Best of Us! - A Meteor 0.9+ package for building REST APIs https://atmospherejs.com/nimble/restivus
MIT License
544 stars 117 forks source link

Authenticate with Google - how to? #280

Open lucnat opened 7 years ago

lucnat commented 7 years ago

I managed to do facebook login like this:

ApiV1.addRoute('facebooklogin', {authRequired: false}, {
    post: {
        action: function () {
            var accessToken = this.bodyParams.accessToken || this.urlParams.accessToken;
            var email = this.bodyParams.email;
            var name = this.bodyParams.name;
            if (accessToken) {
                return facebookLoginWithAccessToken(accessToken, email, name)
            }
            return {
                statusCode: 400,
                body: {
                    status: "fail",
                    message: "Unable to Post to FB Login. Values Received: accessToken: " + accessToken + ", email: " + email + ", name: " + name
                }
            };
        }
    }
});

where the function facebookLoginWithAccessToken is from here: http://stackoverflow.com/questions/18118503/how-can-i-login-to-meteor-with-native-device-facebook

Has anybody got something similar for authentication with google? Would I proceed more or less in the similar way to make this happen?

lucnat commented 6 years ago

Bump