/ecomplus-passport

E-Com Plus service for customer login and signup with Passportjs

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

ecomplus-passport

E-Com Plus service for customer login and signup with Passportjs

Technology stack

Setting up

git clone https://github.com/ecomclub/ecomplus-passport
cd ecomplus-passport
cp config/config-sample.json config/config.json
nano config/config.json

Edit config.json placing correct values for your environment, after that, start app with node:

node ./main.js

Web server

You need to use a web server such as NGINX or Apache HTTP, proxy passing the requests to configured TCP port.

Frontend script

Example

var uri = 'https://passport.e-com.plus/v1/pt_br/1004/sdjcksadcasbcsabdcbsldjlbcasbdcs/login.html'
var popup = window.open(uri, 'Passport', 'height=400,width=340')
if (window.focus) {
  popup.focus()
}
var getCustomerInfo = function () {
  // run after login
  clearInterval(popupWatch)
  console.log('logged?')
}
// public callback function
window.passportCallback = function () {
  // logged
  getCustomerInfo()
}
// fallback
var popupWatch = setInterval(function () {
  if (popup.closed) {
    // may be logged
    getCustomerInfo()
  }
}, 400)