Giter Club home page Giter Club logo

authing-wechat-official-account's Introduction

Authing x WeChat public number sweep code login. Message Forwarding Service.

License

English | 简体中文

Why do I need this service?

You can turn on the server configuration in Development -> Basic Configuration page in the backend of WeChat Public Platform. When users scan the QR code of the public number and follow the public number, Authing will be able to receive the user sweep and follow events to complete the login.

Since only one WeChat server configuration can be set up, you need to choose two different modes according to your specific scenario.

  • Mode 1: Set server address as Authing server endpoint, this mode is the simplest, but all events of WeChat Public will be pushed to Authing server, you will lose other events except sweep and follow.

  • Mode 2: Set the server address as your own server, and then forward the sweep and follow events to Authing server endpoint.

If you have a usage scenario other than user sweep login, you can directly choose mode one; if you have some other business besides user sweep event, such as event push, custom message reply, etc., you need to choose mode two.

This sample project is prepared for a Mode II scenario.

Configuration file

Add the configuration file config.yaml to the directory where the project is located, the sample configuration file is as follows.

port: 3000
wechat:
  appId: xxx
  token: xxx
  encodingAESKey: xxx
  subscribeMessage: Hello and welcome to Authing. \n\nAuthing provides an easy-to-use and scalable identity cloud platform for developers and currently serves tens of thousands of developers and enterprises in seven countries around the world. Our mission is to make identity management easier.

authing:
  host: https://core.authing.cn
  userPoolId: xxx
  socialConnectionIdentifier: xxx

Definition of each item in the configuration file.

  • port: The port number on which this service is running
  • wechat: WeChat public number related configuration
    • appId: WeChat Public AppId
    • token: Token configured in WeChat Public Platform
    • encodingAESKey: EncodingAESKey configured in WeChat Public Platform
    • subscribeMessage: Messages sent to users after they follow
  • authing: Authing Related Configuration
    • host: Authing server address, the default is https://core.authing.cn, if you are deploying privately, you need to change this address to the address of your privatized deployment service.
    • userPoolId: Authing User Pool ID
    • socialConnectionIdentifier: The unique identifier of the WeChat identity source created in Authing, see the documentation for details: https://docs.authing.cn/v2/connections/wechatmp-qrcode/

Launch Project

$ yarn
$ yarn start

Configure server address in WeChat Public

  1. URL to the address where the service is deployed, with the default route being /wechat/events.
  2. Please select secure mode for message encryption method.

Next

Once the above steps are completed, the WeChat Public event forwarding service is finished. Next, you can try to do the WeChat public number sweep login, and it will work if there is no problem!

Questions

For questions and support please use the official forum. The issue list of this repo is exclusively for bug reports and feature requests.

Contribution

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push -u origin my-new-feature)
  • Create new Pull Request

Contribute

https://github.com/Authing/.github/blob/main/CONTRIBUTING.md#English

License

MIT

Copyright (c) 2019-present, Authing

authing-wechat-official-account's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.