Authing DocsDocuments
Concept
workflow
Guides
Development Integration
Application integration
Concept
workflow
Guides
Development Integration
Application integration
Old Version
Guides
  • Quick start

  • Authenticate the user

  • Authority management for users

  • Authorization

  • Manage user accounts

  • Manage User Directory

  • Management Application

  • Become a source of federal authentication identity

  • Connect to an external identity provider (IdP)

  • Open up WeChat ecology
  • Migrate users to Authing

  • Management organization

  • Expandable capabilities

  • Audit Log

  • Configure security information

  • Configure user pool information

  • Deployment plan

  • Frequently Asked Questions FAQs

¶ WeChat login in the mini program

Update Time: 2026-03-25 09:13:34
Edit

Authing The developer provides the developer with a method of obtaining user information in a small program and completing the login. By Authing SDK can easily obtain the user identity identifier provided by WeChat, quickly establish an account system based on the mobile phone number.

  • Application scenario: mini program;
  • Overview: Used in WeChat applets, pop-up WeChat Authorization boxes, and you can get information on the current user after authorization;
  • View WeChat official document (opens new window)

¶ Step 1: Create a small program at the WeChat public platform

Please go to the WeChat public platform (opens new window)Guide creates a WeChat applet, you need to record the application App ID and App Secret, it needs to be used later. If you need to get the user's mobile phone number, you need to pass WeChat certification. and core.authing.cn add WeChat request legal domain name.

¶ Step 2: In the Authing console configuration WeChat applet application

In the console's social login configuration page, find WeChat applet app, fill in the following configuration:

  • App ID: Appliance application ID;
  • App Secret: A small program application key.

Click "OK" to save information after the configuration is complete.

¶ Step 3: Start development access

From the small program base library version 2.2.1 or more, and the developer tool 1.02.1808300 or above, the applet supports the use of NPM to install a third party package, please see: Please see: From the small program base library version 2.2.1 or more, and the developer tool 1.02.1808300 or above, the applet supports the use of NPM to install a third party package, please see: npm support | WeChat open document (opens new window).

¶ Install npm package

Use npm:

npm install authing-wxapp-sdk

or use yarn:

yarn add authing-wxapp-sdk

Click on the menu bar in the developer tool: Tool -> Build NPM:

const { AuthenticationClient } = require("authing-wxapp-sdk");

const authing = new AuthenticationClient({
  appId: "AUTHING_APP_ID"
});

¶ Call login method

AuthenticationClient provides theloginByCode method, you can complete the silent login through WeChat authorization:

const { code } = await wx.login();
// No user authorization
const user = await authing.loginByCode(code); // Successfully logged in, write token to WeChat Storage

// You can do this after logging in
await authing.updateProfile((nickname: "Bob"));

After the user completes the login, the SDK writes the user's token into the WeChat's Storage, and subsequent requests will automatically carry token access.

Subsequent users open the applet, if the user's token is saved in the Storage of the applet, access the authing request will automatically bring the token.

// This request can be successful because the user is out of the login state.
await authing.updateProfile((nickname: "Mick"));

For details, please see the documentation: Apprentrate SDK。

¶ Next

After obtaining the user information, you can get the user's identity credential (the token field ), which you can carry in subsequent requests sent by the client to the backend server token, for axios example :

const axios = require("axios");
axios
  .get({
    url: "https://yourdomain.com/api/v1/your/resources",
    headers: {
      Authorization: "Bearer ID_TOKEN"
    }
  })
  .then(res => {
    // custom codes
  });

The legitimacy of this needs to be checked in the back-end interface to verify the user's identity. For details of the verification method, see Verifying User Identity Credentials (token) . After identifying the user's identity, you may also need to perform permission management on the user to determine whether the user has permission to operate this API.

  • Step 1: Create a small program at the WeChat public platform
  • Step 2: In the Authing console configuration WeChat applet application
  • Step 3: Start development access
  • Next

User identity management

Integrated third-party login
Mobile phone number flash check (opens new window)
Universal login form component
Custom authentication process

Enterprise internal management

Single Sign On
Multi-factor Authentication
Authority Management

Developers

Development Document
Framework Integration
Blog (opens new window)
GitHub (opens new window)
Community User Center (opens new window)

Company

400 888 2106
sales@authing.cn
16 / F, Block B, NORTH STAR CENTURY CENTER, Beijing(Total)
room 406, 4th floor, zone B, building 1, No. 200, Tianfu Fifth Street, Chengdu(branch)

Beijing ICP No.19051205-1

© Beijing Steamory Technology Co.