{"id":15835771,"url":"https://github.com/kaelzhang/weixin-auth","last_synced_at":"2026-05-17T03:12:09.498Z","repository":{"id":65520281,"uuid":"110533420","full_name":"kaelzhang/weixin-auth","owner":"kaelzhang","description":"Wechat authorization","archived":false,"fork":false,"pushed_at":"2018-07-04T02:58:03.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T13:16:19.785Z","etag":null,"topics":["authorization","nodejs","wechat"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaelzhang.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-13T10:23:21.000Z","updated_at":"2018-07-04T02:58:04.000Z","dependencies_parsed_at":"2023-01-27T02:45:17.217Z","dependency_job_id":null,"html_url":"https://github.com/kaelzhang/weixin-auth","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2Fweixin-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2Fweixin-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2Fweixin-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaelzhang%2Fweixin-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaelzhang","download_url":"https://codeload.github.com/kaelzhang/weixin-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246397562,"owners_count":20770575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authorization","nodejs","wechat"],"created_at":"2024-10-05T14:41:21.749Z","updated_at":"2026-05-17T03:12:04.467Z","avatar_url":"https://github.com/kaelzhang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/kaelzhang/weixin-auth.svg?branch=master)](https://travis-ci.org/kaelzhang/weixin-auth)\n[![Coverage](https://codecov.io/gh/kaelzhang/weixin-auth/branch/master/graph/badge.svg)](https://codecov.io/gh/kaelzhang/weixin-auth)\n\u003c!-- optional appveyor tst\n[![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/kaelzhang/weixin-auth?branch=master\u0026svg=true)](https://ci.appveyor.com/project/kaelzhang/weixin-auth)\n--\u003e\n\u003c!-- optional npm version\n[![NPM version](https://badge.fury.io/js/weixin-auth.svg)](http://badge.fury.io/js/weixin-auth)\n--\u003e\n\u003c!-- optional npm downloads\n[![npm module downloads per month](http://img.shields.io/npm/dm/weixin-auth.svg)](https://www.npmjs.org/package/weixin-auth)\n--\u003e\n\u003c!-- optional dependency status\n[![Dependency Status](https://david-dm.org/kaelzhang/weixin-auth.svg)](https://david-dm.org/kaelzhang/weixin-auth)\n--\u003e\n\n# weixin-auth\n\nWechat Authorization\n\n## Install\n\n```sh\n$ npm install weixin-auth\n```\n\n## Usage\n\n```js\nimport {WechatMP, mock} from 'weixin-auth'\n\nconst mp = new WechatMP({\n  appId: '\u003cwechat mini-program appid\u003e',\n  secret: '\u003cwechat mini-program secret\u003e'\n})\n\nawait mp.auth(code)\n// {\n//   openid: ...,\n//   unionid: ...,\n//   session_key: ...\n// }\n\n// We can mock the result for debugging purpose\nmock({\n  openid: 'a',\n  unionid: 'b',\n  session_key: 'c'\n})\n\nawait mp.auth(code)\n// {\n//   openid: 'a',\n//   unionid: 'b',\n//   session_key: 'c'\n// }\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaelzhang%2Fweixin-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaelzhang%2Fweixin-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaelzhang%2Fweixin-auth/lists"}