https://github.com/ecomplus/passport-client
Handle customer authentication with E-Com Plus Passport
https://github.com/ecomplus/passport-client
customer-account ecompassport ecomplus login-system oauth-client social-login storefront-login
Last synced: 7 months ago
JSON representation
Handle customer authentication with E-Com Plus Passport
- Host: GitHub
- URL: https://github.com/ecomplus/passport-client
- Owner: ecomplus
- License: mit
- Created: 2018-04-03T19:20:24.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-03-31T16:04:31.000Z (9 months ago)
- Last Synced: 2025-04-02T11:36:43.805Z (9 months ago)
- Topics: customer-account, ecompassport, ecomplus, login-system, oauth-client, social-login, storefront-login
- Language: JavaScript
- Homepage: http://developers.e-com.plus/passport-client/
- Size: 3.13 MB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# E-Com Plus Passport Client
[](https://github.com/ecomplus/passport-client/actions?workflow=Publish) [](https://www.codefactor.io/repository/github/ecomplus/passport-client) [](https://www.npmjs.org/@ecomplus/passport-client) [](https://opensource.org/licenses/MIT)
Handle customer authentication with E-Com Plus Passport
[CHANGELOG](https://github.com/ecomplus/passport-client/blob/master/CHANGELOG.md)
## Usage
The `@ecomplus/passport-client` package can be used to handle login and persist/manipulate customer account data trough E-Com Plus Passport and Store APIs.
It's available for both Node.js and browser environments.
- [Get started](http://developers.e-com.plus/passport-client/module-@ecomplus_passport-client.html)
- [Class reference](http://developers.e-com.plus/passport-client/EcomPassport.html)
### Example
```js
import ecomPassport from '@ecomplus/passport-client'
ecomPassport.fetchLogin(localStorage.getItem('email'), localStorage.getItem('doc_number'))
ecomPassport.on('logout', () => {
console.log('User logged OUT')
})
ecomPassport.on('login', () => {
console.log('User logged IN', ecomPassport.getCustomer())
ecomPassport.fetchOrdersList()
.then(orders => {
console.log('Listing customer orders', orders)
})
})
```
### Installation
It _may_ require and doesn't include `core-js` (optional) and [`@ecomplus/utils`](https://developers.e-com.plus/utils/) (peer dependency).
#### Webpack
```bash
npm i --save core-js @ecomplus/utils @ecomplus/passport-client
```
#### Node.js
```bash
npm i --save @ecomplus/utils @ecomplus/passport-client
```
#### CDN
```html
```
When importing from CDN, `EventEmitter3`, `ecomUtils` and `ecomClient` libraries **must be included separately** and available on window scope.