Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 338 Bytes

README.md

File metadata and controls

17 lines (14 loc) · 338 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 { openid, session_key, unionid } = await app.code2Session(code);
    // ...
  } catch (e) {
    // ...
  }
});