New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wxapp-auth

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wxapp-auth

wechat mini program auth helper for node.js

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
increased by466.67%
Maintainers
1
Weekly downloads
 
Created
Source

wxapp-auth

CircleCI Build Status Coverage Status PRs Welcome License

(Non-official) Wechat mini program auth helper for Node.js.

Table of Contents

Installation

yarn add wxapp-auth

Usage

import WxappAuth from 'wxapp-auth';

(async function main() {
  const wechatAuth = new WxappAuth({
    appId: '<WECHAT_APP_ID>',
    appSecret: '<WECHAT_APP_SECRET>',
  }));

  const userInfo = await wechatAuth.getUserInfo({
    code: '<LOGIN_CODE>'
    rawData: '<RAW_DATA>',
    signature: '<SIGNATURE>',
  });
}());

Reference

constructor(appId, appSecret)

new WxappAuth(appId, appSecret)

Create a WxappAuth instance.

Arguments
  1. appId <String>: Wechat app id, required
  2. appSecret <String>: Wechat app secret, required

getUserInfo(params)

wxappAuth.getUserInfo(params)
Arguments
  1. Params <Object>
  • code <String>: code from wechat mini program wx.login()
  • sessionKey <String>: Session key from getSession(params)
  • rawData <String>: rawData from wechat mini program wx.getUserInfo()
  • signature <String>: signature from wechat mini program wx.getUserInfo()
  • encryptedData <String>: encryptedData from wechat mini program wx.getUserInfo()
  • iv <String>: iv from wechat mini program wx.getUserInfo()
Note
  • One of code or sessionKey is required
  • One of rawData and signature, or encryptedData and iv are required
Returns

Promise of UserInfo object

getSession(params)

wxappAuth.getSession(params)
Arguments
  1. Params <Object>
  • code <String>: code from wechat mini program wx.login(), required
Returns

Promise of object containing sessionKey, openid, and optional unionid

License

MIT

Keywords

FAQs

Package last updated on 05 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc