Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 400 Bytes

README.md

File metadata and controls

18 lines (15 loc) · 400 Bytes

微信公众号

demo

const app = new WxMiniApp("APP_ID", "SECRET");

router.post("/auth", async (context) => {
  try {
    const { code } = await context.request.body({ type: "json" }).value;
    const { access_token, openid } = await wxH5.getAccessToken(code);
    const userinfo = await wxH5.getUserInfo(openid, access_token);
    // ...
  } catch (e) {
    // ...
  }
});