/passport-zalo

A Zalo login - get profile for Passport.js, from https://github.com/zaloplatform/zalo-nodejs-sdk and https://github.com/didinj/node-facebook-twitter-google-github-login

Primary LanguageJavaScript


How to use passport-zalo: In passport.js, we will set up config:

var ZaloStrategy = require('passport-zalo').Strategy; passport.use(new ZaloStrategy({ clientID: "clientID", clientSecret: "clientSecret", callbackURL: "https://domain.com/api/account/login-by-zalo", },function (accessToken, refreshToken, profile, done) { return done(profile); } ));

In controller:

'get /api/account/login-by-zalo': 'Controller.LoginByZalo', LoginByZalo: function (req, res) { passport.authenticate('zalo', function (err, data) { if (err || !data) { return res.failed("ERR01",err,data); } else { return res.success(data); } })(req, res); },

Success:
gender, name(fullname), picture.data.url, birthday,id

Error: throw or zalo oathor error