Skip to content

longldktmm/passport-zalo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation


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