Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeff-tian/egg-passport-weapp
Wechat mini program passport plugin for egg
https://github.com/jeff-tian/egg-passport-weapp
authentication egg egg-passport egg-plugin oauth2 passport wechat wechat-mini-program
Last synced: about 3 hours ago
JSON representation
Wechat mini program passport plugin for egg
- Host: GitHub
- URL: https://github.com/jeff-tian/egg-passport-weapp
- Owner: Jeff-Tian
- License: mit
- Created: 2019-08-05T11:20:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-15T09:10:16.000Z (about 5 years ago)
- Last Synced: 2024-10-07T01:36:25.575Z (about 1 month ago)
- Topics: authentication, egg, egg-passport, egg-plugin, oauth2, passport, wechat, wechat-mini-program
- Language: TypeScript
- Size: 21.5 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# egg-passport-weapp
> Wechat miniprogram passport plugin for egg.
[![NPM version][npm-image]][npm-url]
[![Build Status](https://travis-ci.com/Jeff-Tian/egg-passport-weapp.svg?branch=master)](https://travis-ci.com/Jeff-Tian/egg-passport-weapp)
[![codecov](https://codecov.io/gh/Jeff-Tian/egg-passport-weapp/branch/master/graph/badge.svg)](https://codecov.io/gh/Jeff-Tian/egg-passport-weapp)
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)[npm-image]: https://img.shields.io/npm/v/egg-passport-weapp.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-passport-weapp
[david-image]: https://img.shields.io/david/jeff-tian/egg-passport-weapp.svg?style=flat-square
[david-url]: https://david-dm.org/jeff-tian/egg-passport-weapp
[snyk-image]: https://snyk.io/test/npm/egg-passport-weapp/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-passport-weapp
[download-image]: https://img.shields.io/npm/dm/egg-passport-weapp.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-passport-weapp## Example
Open [https://uniheart.herokuapp.com/](https://uniheart.herokuapp.com/) to see the result.
## Install
```bash
$ npm i egg-passport-weapp --save
```## Usage
```js
// {app_root}/config/plugin.[t|j]s
exports.passportWeapp = {
enable: true,
package: "egg-passport-weapp"
};
```## Configuration
```js
// {app_root}/config/config.default.[t|j]s
exports.passportWeapp = {
key: "your oauth key",
secret: "your oauth secret"
};// {app_root}/app/router.js
app.passport.mount("weapp", app.config.passportWeapp);
router.get("/passport/weapp/callback", ctx => {
// Now get you get ctx.user, write your login logic here,
// for example, write session
ctx.session.userId = ctx.user.id;// And then return something instead of redirect
ctx.body = ctx.user;
});
```see [config/config.default.ts](config/config.default.ts) for more detail.
## Example
| Wechat Mini Program | Wechat Mini Program Demo version |
| :---------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: |
| ![Hardway](https://github.com/Jeff-Tian/me/raw/master/src/images/gh_e56e6784a430_258.jpg) | ![Hardway Demo](https://github.com/Jeff-Tian/me/raw/master/src/images/odrHN4lVhrjiktR18jU8Hn1Z2chY.jpg) |## Questions & Suggestions
Please open an issue [here](https://github.com/eggjs/egg/issues).
## License
[MIT](LICENSE)
## Test
```shell
npm run test-local
```## Release Notes: