JS client for E-Com Plus admin authentication
The @ecomplus/auth
package can be used to handle login and persist/manipulate admin account data and resources permitted trough E-Com Plus Store API.
It's available for both Node.js and browser environments.
import ecomAuth from '@ecomplus/auth'
ecomAuth.login(localStorage.getItem('username'), localStorage.getItem('password'))
ecomAuth.on('login', self => {
console.log('Login OK!', self)
ecomAuth.createEcomplusSession().then(r => console.log(r))
})
ecomAuth.on('logout', self => {
console.log('Out!', self)
})