2.0.6 • Published 4 years ago

koa-weixin-auth v2.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago
使用用例
	const Koa = require("koa");
	const Router = require("koa-router");
	const Auth = require("koa2-weixin-auth");

	const app = new Koa();
	const router = new Router();
	const auth = new Auth("appid","appsecret");

	router.get("/", async(ctx, next) => {
		const url = await auth.getAuthorizeURL('redirect_url','snsapi_userinfo','');
		ctx.redirect(url);
	})

	router.get("/getcode", async(ctx, next) => {
		const token = await auth.getAccessToken(ctx.request.query.code);
		const accessToken = token.data.access_token;
		const openid = token.data.openid;
		const userinfo = await auth.getUser(openid);
		
	})

	app.use(router.routes());
	app.listen(3000);
2.0.5

4 years ago

2.0.6

4 years ago

2.0.3

4 years ago

2.0.4

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago