1.2.0 • Published 8 years ago

@weflex/passport.js v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

Passport.js

The passport utility library to create request to authorization providers at browser-side.

Install

$ npm install @weflex/passport.js

Example

import {
  WeChatProvider,
  Passport
} from '@weflex/passport.js';

const wechat = new WeChatProvider({
  appid: 'appid',
  secret: 'secret',
  redirectUri: location.href
});

// get url for requesting code
const url = wechat.getUrlForCode();
// here you can pass url or set in `location.href`

const passport = new Passport({ wechat });

// directly goto url
await passport.auth('wechat');

// print payload
console.log(passport.payload);

License

MIT Licensed @ WeFlex, Inc