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 internal web page uses WeChat Authorized Login

Update Time: 2025-06-11 08:01:00
Edit

Authing developer provides the developer with a method of obtaining user information in the WeChat web page and completing the login. If the user accesses a third-party web page in the WeChat client, the public account can obtain the basic information of the user through the WeChat webpage authorization mechanism, and then implement business logic.

  • Application Scene: WeChat web page, public number;
  • Overview: The WeChat Authorization box is popped up within the webpage within the WeChat app. After the user authorizes the current user information;
  • View WeChat official document (opens new window)。

¶ Sample code

You can get sample code here:https://github.com/authing/wechat-eco-solution (opens new window), Access online sample application (opens new window)。

¶ Step 1: Create a WeChat service number in the WeChat public platform

Please go to the WeChat public platform (opens new window) guide creates a WeChat service number.

You need to record the developer ID (App ID) and Developer Key (App Secret), It needs to be used later. In the background of WeChat public platform setting -> Public number setting -> Function setting page settings Web Page Authorization Scope is core.authing.cn. In the process, you need to check the legality of the domain name. For details, please see the next step.

¶ Step 2: In the Authing console Configure WeChat webpage authorization applications

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

  • App ID: Developer ID;
  • App Secret: Developer key;
  • Callback URL:This is your business callback domain name, and the callback link configured by the socialized login application is different. For example, your website domain name is https://example.com , deal with Authing callback request url is /auth/callback , Then you should fill in https://example.com/auth/callback. If you need to configure the callback link separately in your application, this address can be filled in: #.
  • Txt Filename: txt file name used to verify the domain name.
  • Txt Content: txt file content used to verify the domain name.

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

¶ Step 3: Start development access

First use CDN introduction authing-wxmp-sdk:

<script src="https://cdn.jsdelivr.net/npm/@authing/wxmp/dist/authing-wxmp-sdk.min.js"></script>

authing-wxmp-sdk For detailed documentation, please see:WeChat web page authorization login SDK。

¶ initialization SDK

Use the userpool ID to initialize SDK:

const authingWx = new AuthingWxmp({
  userPoolId: "YOUR_USERPOOLID"
});

¶ Launched WeChat Authorization

Call the getAuthorizationUrl method Get the WeChat Authorized Login link, modify thewindow.location jump to the WeChat login authorization page:

// Jump to WeChat Authorization page
window.location = authingWx.getAuthorizationUrl();

¶ Get user information

Jump back to the business callback link After getting user information by getUserInfo method:

// If the callback page authingWx is not initialized, it is necessary to initialize first, and the specific initialization method reference is

const { ok, userinfo, message } = authingWx.getUserInfo();
if (ok) {
  // do with userinfo
  console.log(userinfo);
} else if (message) {
  // message contains an error message
  alert(message);
}

¶ 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.

  • Sample code
  • Step 1: Create a WeChat service number in the WeChat public platform
  • Step 2: In the Authing console Configure WeChat webpage authorization applications
  • 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.