WeChat server authentication module for node-weixin-api and node-weixin-express. Version 0.6.3 provides token acquisition, automatic token refresh with configurable GAP, server IP retrieval, and message signature verification. It is part of the node-weixin ecosystem and requires node-weixin-settings for configuration persistence. Compared to other WeChat SDKs, it offers manual and automatic tokenization with a time gap to reduce expiration failures. The package has a moderate release cadence and is primarily used in Chinese development communities.
npm install node-weixin-authVerified import paths — ran on the pinned version, not inferred.
Initializes WeChat auth with app credentials, manually fetches a token, and sets up automatic token refresh.
Use determine(settings, app, function() { ... }) without parameters in the callback.Set nodeWeixinAuth.TIME_GAP = <desired seconds> before calling determine.
Parse query string with extract before passing to ack.
Check that app.id, app.secret, and app.token are set to valid WeChat credentials.
Check if (!error && json) before using json.access_token.
Use const nodeWeixinAuth = require('node-weixin-auth');.Create settings with require('node-weixin-settings') and configure it.