Multi-official-account joint login method and device, electronic equipment and storage medium

By obtaining the token or UnionID of the WeChat official account, the unconscious joint login of multiple public accounts is solved, and the login problem of different public accounts under the same account subject is improved, the user experience is ensured and security is ensured, and the unified management of member information and user behavior data is supported.

CN120433989APending Publication Date: 2025-08-05BEIJING HAIKE RONGTONG PAYMENT SERVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510563660.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

During the login process of different public accounts under the same account subject in the WeChat public account, the user experience is poor and there are security risks. The existing technology requires users to log in independently under each public account.

Method used

By obtaining the user's official account identification in the target official account, obtaining the corresponding token for invisible login. If the token is not obtained, use the UnionID in WeChat to log in, and the UnionID is associated with multiple official accounts.

Benefits of technology

It realizes joint login of multiple public accounts without perception, improves user experience, and ensures login security through UnionID, connects member information and user behavior data, and supports CRM and precise marketing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120433989A_ABST
    Figure CN120433989A_ABST
Patent Text Reader

Abstract

The invention relates to a multi-official-account joint login method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a login request initiated by a user in a target official account, and the login request comprises an official account identifier of the target official account; acquiring a token corresponding to the target official account according to the official account identifier of the target official account; if the token corresponding to the target official account is obtained, judging that the user successfully logs in the target official account; and if the token corresponding to the target official account is not obtained, obtaining a UnionID of the user in WeChat, and successfully logging in the target official account based on the UnionID. By means of the method, non-inductive login can be achieved, and when the token corresponding to the target official account is not obtained, the target official account can be logged in based on the UnionID of the user in WeChat.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of web development technology, and in particular to a method, device, electronic device and storage medium for joint login of multiple public accounts. Background Art

[0002] In WeChat official accounts, the same account entity (company) can have multiple official accounts, and the company can also have multiple product lines. In the existing technology, each user has a different openid and the same UnionID in different official accounts under the same account entity. For the same user, if you log in to different official accounts, the user needs to participate in each login. This not only provides a poor user experience but also poses login security risks. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a method, device, electronic device and storage medium for joint login of multiple public accounts, aiming to solve at least one of the above technical problems.

[0004] In a first aspect, the present invention provides a technical solution to the above-mentioned technical problem as follows: a method for joint login of multiple public accounts, the method comprising: Obtain a login request initiated by a user on a target official account, wherein the login request includes the official account identifier of the target official account, and the target official account is any one of multiple official accounts of the same account owner in WeChat; Obtain the token corresponding to the target official account according to the official account identifier of the target official account; If the token corresponding to the target official account is obtained, it is determined that the user has successfully logged into the target official account; If the token corresponding to the target official account is not obtained, the user's UnionID in WeChat is obtained, and the target official account is successfully logged in based on the UnionID. The UnionID is used to represent the user's identity in WeChat, and the UnionID is associated with multiple official accounts corresponding to the user.

[0005] The beneficial effect of the present invention is that when a user needs to log in to a target public account, he only needs to initiate a login request through the front end. The back end can realize seamless login by obtaining the token corresponding to the target public account based on the public account identifier of the target public account in the login request. If the token corresponding to the target public account is not obtained, the purpose of logging in to the target public account can also be achieved based on the user's UnionID in WeChat.

[0006] On the basis of the above technical solution, the present invention can also be improved as follows.

[0007] Furthermore, the successful login to the target official account based on the UnionID includes: According to the UnionID, determine whether the user is a registered user; If the user is a registered user, a token corresponding to the target public account is generated according to the public account identifier of the target public account, so as to log in to the target public account based on the token corresponding to the target public account; If the user is not a registered user, the page will be redirected to the registration page so that the user can successfully register on the registration page to log in to the target public account.

[0008] Furthermore, judging whether the user is a registered user based on the UnionID includes: According to the UnionID, obtain the user's username in the target official account from the browser local storage space corresponding to the target official account; If the user name cannot be obtained from the browser local storage space, it is determined that the user is not a registered user. If the user name is obtained from the browser local storage space, it is determined that the user is a registered user.

[0009] Furthermore, before obtaining the login request initiated by the user on the target official account, the method further includes: Detect whether the execution environment corresponding to the login request is the WeChat environment; If the execution environment is a WeChat environment, obtaining a login request initiated by the user in the target official account; If the execution environment is not the WeChat environment, generate environment prompt information.

[0010] Furthermore, if the token corresponding to the target official account is not obtained, the method further includes: Determine whether the page the user is about to enter is a page that requires login; If a login page is required, jump to the login page to obtain the token corresponding to the target official account based on the login page; If the login page is not required, jump to the page the user is about to enter.

[0011] Furthermore, if a login page is required, jump to the login page to obtain the token corresponding to the target official account based on the login page, including: If a login page is required, jump to the login page and obtain rspCode from the address bar. The rspCode is a response status parameter indicating the login request. If the value of the rspCode is 00, the token obtained from the address bar is determined as the token corresponding to the target official account; If the value of the rspCode is not 00, the user's login information is obtained to obtain the token corresponding to the target public account based on the login information.

[0012] Furthermore, after successfully logging into the target public account, the method further includes: Determining whether the user has undergone real-name authentication; If the user has not performed real-name authentication, real-name authentication is performed on the user.

[0013] In a second aspect, in order to solve the above technical problems, the present invention further provides a multi-official account joint login device, which includes: A login request acquisition module is used to acquire a login request initiated by a user on a target official account, wherein the login request includes the official account identifier of the target official account, and the target official account is any one of multiple official accounts of the same account owner in WeChat; A token acquisition module is used to obtain the token corresponding to the target official account according to the official account identifier of the target official account; A first judgment module is used to determine whether the user has successfully logged into the target official account after obtaining the token corresponding to the target official account; The second judgment module is used to obtain the user's UnionID in WeChat if the token corresponding to the target official account is not obtained, and successfully log in to the target official account based on the UnionID. The UnionID is used to represent the user's identity in WeChat, and the UnionID is associated with multiple official accounts corresponding to the user.

[0014] In the third aspect, in order to solve the above-mentioned technical problems, the present invention also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, the multi-public account joint login method of the present application is implemented.

[0015] In a fourth aspect, in order to solve the above-mentioned technical problems, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the multi-public account joint login method of the present application is implemented.

[0016] Additional aspects and advantages of the present application will be given in part in the following description, which will become apparent from the following description, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments of the present invention.

[0018] Figure 1 A flowchart of a multi-official account joint login method provided by one embodiment of the present invention; Figure 2 A flowchart of another method for joint login of multiple public accounts provided by one embodiment of the present invention; Figure 3 A schematic diagram of the structure of a multi-official account joint login device provided by one embodiment of the present invention; Figure 4 The present invention provides a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The principles and features of the present invention are described below. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.

[0020] The following describes in detail the technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems using specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The following embodiments of the present invention are described in conjunction with the accompanying drawings.

[0021] The solution provided by the embodiments of the present invention can be applied to any application scenario that requires logging into a public account in WeChat. The solution provided by the embodiments of the present invention can be executed by any electronic device, for example, a user's terminal device. The terminal device can be any terminal device that can install applications and access web pages through applications, including at least one of the following: a smartphone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart TV, and a smart car device.

[0022] The embodiment of the present invention provides a possible implementation method, such as Figure 1 As shown, a flowchart of a method for joint login of multiple public accounts is provided. The solution can be executed by any electronic device, for example, a terminal device, or jointly executed by a terminal device and a server. For the convenience of description, the method provided by the embodiment of the present invention will be described below using the server, which can also be called the backend, as an example of the execution subject. Figure 1 As shown in the flowchart, the method may include the following steps: S10, obtaining a login request initiated by a user on a target official account, wherein the login request includes an official account identifier of the target official account, and the target official account is any one of multiple official accounts of the same account holder in WeChat; S20, obtaining a token corresponding to the target official account according to the official account identifier of the target official account; S30, if the token corresponding to the target official account is obtained, it is determined that the user has successfully logged into the target official account; If the token corresponding to the target official account is not obtained, the user's UnionID in WeChat is obtained, and the target official account is successfully logged in based on the UnionID. The UnionID is used to represent the user's identity in WeChat, and the UnionID is associated with multiple official accounts corresponding to the user.

[0023] Through the method of the present invention, when a user needs to log in to a target public account, he or she only needs to initiate a login request through the front end. The back end can realize seamless login by obtaining a token corresponding to the target public account based on the public account identifier of the target public account in the login request. If the token corresponding to the target public account is not obtained, the purpose of logging in to the target public account can also be achieved based on the user's UnionID in WeChat.

[0024] The solution of the present invention is further described below with reference to the following specific embodiment. In this embodiment, the multi-official account joint login method may include the following steps: S10, obtaining a login request initiated by a user on a target official account, wherein the login request includes an official account identifier of the target official account, and the target official account is any one of multiple official accounts of the same account holder in WeChat; As an example, see Figure 2 The target public account can be any one of the three public accounts A, B, and C.

[0025] Among them, before S10, it also includes: S01, detecting whether the execution environment corresponding to the login request is the WeChat environment; Figure 2 Verification "procedure" in .

[0026] S02, if the execution environment is the WeChat environment, then execute S10, corresponding to Figure 2 Get "source" in; S03, if the execution environment is not the WeChat environment, generate environment prompt information, for example, a pop-up window prompts "incorrect environment", and terminate the program execution.

[0027] S20, according to the public account identification of the target public account, obtain the token corresponding to the target public account, corresponding to Figure 2Get the "Token" in the program; in this solution, the uppercase and lowercase "t" in "Token" have the same meaning.

[0028] Among them, token is a string of characters generated by the server, which serves as a token for the client (front-end) to make requests. After the first login, the server generates a token and returns it to the client. In the future, the client only needs to bring this token to request data without having to bring the username and password again.

[0029] Specifically, the token corresponding to the target official account can be obtained from the browser cache cookies according to the official account identifier of the target official account.

[0030] S30, if the token corresponding to the target public account is obtained (corresponding to Figure 2 Token is obtained successfully), then it is determined that the user has successfully logged into the target public account (corresponding to Figure 2 Login successful in ); Among them, if the token corresponding to the target official account is obtained, it means that this is not the first time the user logs in to the target official account, and this login can be achieved based on the token.

[0031] If the token corresponding to the target public account is not obtained (corresponding to Figure 2 If the verification token in the WeChat account fails, the user's UnionID in WeChat is obtained (the user's UnionID in WeChat can be obtained through WeChat authorization), and the target official account is successfully logged in based on the UnionID. The UnionID is used to represent the user's identity in WeChat and is associated with multiple official accounts corresponding to the user.

[0032] Among them, users have different openids and the same UnionID in different public accounts under the same account entity.

[0033] Optionally, in this solution, the AppIDs and AppSecrets of multiple public accounts are maintained in the backend, and the source is used as an identifier to obtain user information corresponding to different public accounts.

[0034] To ensure security, the system is designed to have a backend program interact with WeChat to perform WeChat authorization login. The backend then obtains the UnionID through WeChat authorization to log in. One possible implementation method is: When the backend opens the backend WeChat authorization login interface through window.location.href on the front end, it first obtains the official account ID of the target official account, searches for the corresponding AppID and AppSecret through the official account ID of the target official account, and obtains user details from WeChat; After obtaining the user's detailed information, the user is searched by UnionID. If the user is registered, a token is generated based on the target official account's official account number and rspCode="00" is set and returned to the front-end to enable seamless login. If the user is not registered, rspCode="01" is set and returned to the front-end. The user enters their mobile phone number and SMS verification code to log in.

[0035] The specific implementation process of logging in and registering using a mobile phone number and SMS verification code is as follows: The user logs in via SMS verification code on the frontend. The frontend verifies the graphic verification code, SMS verification code, and source in sequence. The source parameter is used to find the corresponding AppID and AppSecret, and the user's details are retrieved from WeChat. If the user is not registered, the user is registered. After registration, a token is generated based on the source, stored in Redis, and returned to the frontend. If the user is already registered, the source is directly retrieved from Redis. If it exists and is expired, it is returned to the frontend. If it does not exist or has expired, a token is generated and returned to the frontend.

[0036] Optionally, the successful logging into the target official account based on the UnionID in S30 includes: According to the UnionID, determine whether the user is a registered user, that is, whether it is the first time for the user to log in to the target public account; Figure 2 Verify whether the user exists through the user center.

[0037] If the user is a registered user, a token corresponding to the target public account is generated according to the public account identifier of the target public account, so as to log in to the target public account based on the token corresponding to the target public account; If the user is not a registered user, a code can be returned to the front end to inform the user that real-name authentication has not been performed, and jump to the registration page so that the user can successfully register on the registration page. In this way, there will be a corresponding token, which can be used to log in to the target official account.

[0038] Optionally, judging whether the user is a registered user based on the UnionID includes: According to the UnionID, obtain the user ID of the user in the target official account from the browser local storage space corresponding to the target official account; If the user name cannot be obtained from the browser local storage space, it is determined that the user is not a registered user. If the user name is obtained from the browser local storage space, it is determined that the user is a registered user.

[0039] Furthermore, if the username cannot be retrieved from the browser's local storage, a new username can be generated and stored in the browser's local storage via localStorage. The new username can be generated based on the target official account's official account ID, a timestamp (corresponding to the login request), and a 6-digit random number.

[0040] Optionally, if a token corresponding to the target official account is obtained, the method further includes: Determine whether the page the user is about to enter is a login page. If it is a login page, jump to the homepage. If it is not a login page, obtain the user real-name status in vuex. If the user real-name status in vuex is empty, obtain the user real-name status from the backend through the token corresponding to the target public account, and update the obtained user real-name status to vuex; among them, the user real-name status indicates whether the user has undergone real-name authentication.

[0041] Optionally, if the token corresponding to the target official account is not obtained, the method further includes: Determine whether the page the user is about to enter is a page that requires login; If a login page is required, jump to the login page (front-end login page) to obtain the token corresponding to the target official account based on the login page; If the page does not require a login, jump to the page the user is about to enter so that the user can access it directly.

[0042] The required login page refers to whether the page the user wants to access is a page that requires login before access; if it is a page that requires login before access, it is a required login page; if it is a page that can be accessed without logging in first, it is not a required login page.

[0043] Furthermore, if a login page is required, jump to the login page to obtain the token corresponding to the target official account based on the login page, including: If a login page is required, jump to the login page and obtain rspCode from the address bar. The rspCode is a parameter indicating the response status of the login request. The value of rspCode indicates whether a valid response is made to the login request. If the value of the rspCode is 00, indicating a valid response to the login request, the token obtained from the address bar can be determined as the token corresponding to the target public account; further, the token can be stored in the browser's cookies and jump to the homepage; If the value of the rspCode is not 00, indicating that there is no valid response to the login request, the user's login information is obtained to obtain the token corresponding to the target public account based on the login information.

[0044] Furthermore, if the value of the rspCode is not 00, then the user's login information is obtained, and one implementation method for obtaining the token corresponding to the target official account based on the login information is: Log in using the user's login information (such as mobile phone number and SMS verification code). After logging in, you can obtain the token corresponding to the target official account. Specifically: First, a graphic verification code is obtained. The user enters their mobile phone number, the graphic verification code, and clicks the Get SMS button. The backend verifies whether the graphic verification code is correct. If it is incorrect, the graphic verification code is updated and the user is prompted to re-enter it. If it is correct, a text message verification code is sent to the user. After entering the text message verification code, the user clicks the Login / Register button. The parameters corresponding to this login are added to the target public account's public account identifier source obtained from the browser session storage, and the backend SMS verification code login interface is requested. If the user successfully logs in using the SMS verification code, the frontend stores the obtained token in the browser's cookies and redirects to the homepage. If unsuccessful, the backend pops up and returns an error message.

[0045] Furthermore, if the rspCode is not obtained from the address bar, the backend WeChat authorized login interface is opened through window.location.href, and the redirectUrl parameter value obtained from the address bar is used as the URL of the current login page. After the backend obtains the user information, it redirects to this URL (i.e., the current login page address, with the rspCode and token parameters) to complete the login. The target public account's public account source is the source of the public account the user entered from, obtained from the browser's local storage, and the userID is the userID obtained from the browser's local storage.

[0046] The parameter redirectUrl is obtained from the address bar, indicating the URL address to which the user will be redirected after completing the login and real-name authentication process. If the parameter redirectUrl cannot be obtained, the program execution can be terminated with a pop-up window prompting "Incorrect target address". If the parameter redirectUrl is obtained, the parameter redirectUrl will be stored in the browser's session storage through sessionStorage.

[0047] The target public account's public account source is the source parameter obtained from the address bar, indicating which public account the user entered the program from. If the target public account's public account source cannot be obtained, a pop-up window will prompt "Incorrect source" and terminate program execution. If the parameter redirectUrl is obtained, the target public account's public account source will be stored in the browser's session storage through sessionStorage.

[0048] Optionally, after successfully logging into the target public account, the method further includes: Determining whether the user has undergone real-name authentication; If the user has not performed real-name authentication, real-name authentication is performed on the user, specifically, the user's real-name status is determined on the front-end homepage, and real-name authentication is performed on the front-end real-name authentication page.

[0049] The specific process of real-name authentication on the real-name authentication page is as follows: On the real-name authentication page, the user enters their name and ID number and clicks the real-name authentication button. The front-end carries the parameters token, name, and ID number to request the back-end real-name authentication interface. The backend completes the real-name authentication based on the received parameters, and the front-end updates the real-name authentication status in vuex and jumps to the homepage.

[0050] Among them, the backend receives the user name, ID number and token passed by the frontend, and uses the token to query the user's mobile phone number for three-factor authentication. The authentication returns the user status to the frontend, and the frontend determines the user's real-name status in vuex. If the status is "N", it jumps to the user's real-name page. If the status is "Y", it means that the user has registered and passed the real-name authentication. The targetUrl address is obtained from the browser's local storage and the token in the browser cookies is spliced and opened through window.location.href. The joint login process is completed.

[0051] Optionally, if the login request is initiated by the user when accessing the front-end project page, the beforeEach routing guard can be executed in the main entrance of the vue project. Since the routing guard is set, the user status operation is updated (obtain the user real-name status in vuex. If the user real-name status in vuex is empty, obtain the user real-name status from the backend through the token, and update the obtained user real-name status to vuex) and enter the homepage.

[0052] Furthermore, the user real-name status in vuex is judged. If the user real-name status is "N" (indicating that real-name authentication has not been performed), the page will be jumped to. If the user real-name status is "Y", it means that the user has registered and can pass the real-name authentication, the targetUrl address is obtained from the browser local storage and the token in the browser cookies is spliced and opened through window.location.href, and the joint login process is completed.

[0053] The solution of the present invention has the following beneficial effects: This application provides a WeChat multi-official account and multi-product line joint login system. Its purpose is to uniquely identify the same user across different WeChat official accounts and products, integrate member information and points, integrate user behavior across multiple scenarios, support CRM and precision marketing, and enable seamless user login and ensure login security.

[0054] Based on Figure 1 The same principle as the method shown in , the embodiment of the present invention also provides a multi-public account joint login device 20, such as Figure 3 As shown in , the multi-official account joint login device 20 may include a login request acquisition module 210, a token acquisition module 220, a first judgment module 230 and a second judgment module 240, wherein: A login request acquisition module 210 is configured to acquire a login request initiated by a user on a target official account, wherein the login request includes the official account identifier of the target official account, and the target official account is any one of multiple official accounts of the same account holder in WeChat; The token acquisition module 220 is used to obtain the token corresponding to the target official account according to the official account identifier of the target official account; The first judgment module 230 is used to determine whether the user has successfully logged into the target official account after obtaining the token corresponding to the target official account; The second judgment module 240 is used to obtain the user's UnionID in WeChat if the token corresponding to the target official account is not obtained, and successfully log in to the target official account based on the UnionID. The UnionID is used to represent the user's identity in WeChat, and the UnionID is associated with multiple official accounts corresponding to the user.

[0055] Optionally, when successfully logging into the target official account based on the UnionID, the second judgment module 240 is specifically configured to: According to the UnionID, determine whether the user is a registered user; If the user is a registered user, a token corresponding to the target public account is generated according to the public account identifier of the target public account, so as to log in to the target public account based on the token corresponding to the target public account; If the user is not a registered user, the page will be redirected to the registration page so that the user can successfully register on the registration page to log in to the target public account.

[0056] Optionally, when determining whether the user is a registered user based on the UnionID, the second determination module 240 is specifically configured to: According to the UnionID, obtain the user's username in the target official account from the browser local storage space corresponding to the target official account; If the user name cannot be obtained from the browser local storage space, it is determined that the user is not a registered user. If the user name is obtained from the browser local storage space, it is determined that the user is a registered user.

[0057] Optionally, before obtaining the login request initiated by the user on the target official account, the apparatus further includes: The detection module is used to detect whether the execution environment corresponding to the login request is the WeChat environment; if the execution environment is the WeChat environment, the processing process of the login request acquisition module 210 is executed; if the execution environment is not the WeChat environment, the environment prompt information is generated.

[0058] Optionally, if the token corresponding to the target official account is not obtained, the device further includes: The third judgment module is used to determine whether the page the user is about to enter is a required login page; if it is a required login page, jump to the login page to obtain the token corresponding to the target public account based on the login page; if it is not a required login page, jump to the page the user is about to enter.

[0059] Optionally, when jumping to the login page to obtain the token corresponding to the target official account based on the login page, the third judgment module is specifically configured to: If a login page is required, jump to the login page and obtain rspCode from the address bar. The rspCode is a response status parameter indicating the login request. If the value of the rspCode is 00, the token obtained from the address bar is determined as the token corresponding to the target official account; If the value of the rspCode is not 00, the user's login information is obtained to obtain the token corresponding to the target public account based on the login information.

[0060] Optionally, after successfully logging into the target public account, the device further includes: The authentication module is used to determine whether the user has performed real-name authentication; if the user has not performed real-name authentication, then perform real-name authentication on the user.

[0061] The multi-public account joint login device of an embodiment of the present invention can execute the multi-public account joint login method provided by the embodiment of the present invention. The implementation principle is similar. The actions performed by each module and unit in the multi-public account joint login device in each embodiment of the present invention correspond to the steps in the multi-public account joint login method in each embodiment of the present invention. For the detailed functional description of each module of the multi-public account joint login device, please refer to the description in the corresponding multi-public account joint login method shown in the previous text, and will not be repeated here.

[0062] Among them, the above-mentioned multi-public account joint login device can be a computer program (including program code) running in a computer device, for example, the multi-public account joint login device is an application software; the device can be used to execute the corresponding steps in the method provided in the embodiment of the present invention.

[0063] In some embodiments, the multi-public account joint login device provided by the embodiment of the present invention can be implemented in a combination of software and hardware. As an example, the multi-public account joint login device provided by the embodiment of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the multi-public account joint login method provided by the embodiment of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.

[0064] In other embodiments, the multi-official account joint login device provided by the embodiment of the present invention can be implemented in software. Figure 3 A multi-public account joint login device stored in a memory is shown, which can be software in the form of programs and plug-ins, and includes a series of modules, including a login request acquisition module 210, a token acquisition module 220, a first judgment module 230 and a second judgment module 240, which are used to implement the multi-public account joint login method provided by an embodiment of the present invention.

[0065] The modules involved in the embodiments of the present invention may be implemented in software or hardware, wherein the name of a module does not necessarily limit the module itself.

[0066] Based on the same principle as the method shown in the embodiments of the present invention, an electronic device is also provided in the embodiments of the present invention, which may include but is not limited to: a processor and a memory; the memory is used to store computer programs; the processor is used to execute the method shown in any embodiment of the present invention by calling the computer program.

[0067] In an alternative embodiment, an electronic device is provided, such as Figure 4 As shown, Figure 4The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data exchange between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the number of transceivers 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present invention.

[0068] Processor 4001 can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the present disclosure. Processor 4001 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, or a combination of a DSP and a microprocessor.

[0069] Bus 4002 may include a path for transmitting information between the above components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. Bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0070] The memory 4003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.

[0071] The memory 4003 is used to store application code (computer program) for executing the solution of the present invention, and is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the content shown in the above method embodiment.

[0072] Among them, the electronic device can also be a terminal device, Figure 4 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present invention.

[0073] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding contents of the aforementioned method embodiment.

[0074] According to another aspect of the present invention, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various implementations described above.

[0075] Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0076] It should be understood that the flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or can be implemented using a combination of dedicated hardware and computer instructions.

[0077] The computer-readable storage medium provided by the embodiments of the present invention may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or device.

[0078] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0079] The above description is merely an illustration of preferred embodiments of the present invention and the underlying technical principles. Those skilled in the art should understand that the scope of the present invention is not limited to technical solutions formed by specific combinations of the aforementioned technical features. It also encompasses other technical solutions formed by any combination of the aforementioned technical features or their equivalents, without departing from the aforementioned concepts. For example, a technical solution formed by replacing the aforementioned features with (but not limited to) technical features with similar functions disclosed in this invention.

Claims

1. A method for joint login of multiple public accounts, characterized in that: The following steps are involved: Obtain a login request initiated by a user on a target official account, wherein the login request includes the official account identifier of the target official account, and the target official account is any one of multiple official accounts of the same account owner in WeChat; Obtain the token corresponding to the target official account according to the official account identifier of the target official account; If the token corresponding to the target official account is obtained, it is determined that the user has successfully logged into the target official account; If the token corresponding to the target official account is not obtained, the user's UnionID in WeChat is obtained, and the target official account is successfully logged in based on the UnionID. The UnionID is used to represent the user's identity in WeChat, and the UnionID is associated with multiple official accounts corresponding to the user.

2. The method according to claim 1, characterized in that The successful login to the target official account based on the UnionID includes: According to the UnionID, determine whether the user is a registered user; If the user is a registered user, a token corresponding to the target public account is generated according to the public account identifier of the target public account, so as to log in to the target public account based on the token corresponding to the target public account; If the user is not a registered user, the page will be redirected to the registration page so that the user can successfully register on the registration page to log in to the target public account.

3. The method according to claim 2, characterized in that The determining, based on the UnionID, whether the user is a registered user includes: According to the UnionID, obtain the user's username in the target official account from the browser local storage space corresponding to the target official account; If the user name cannot be obtained from the browser local storage space, it is determined that the user is not a registered user. If the user name is obtained from the browser local storage space, it is determined that the user is a registered user.

4. The method according to any one of claims 1 to 3, characterized in that Before obtaining the login request initiated by the user on the target official account, the method further includes: Detect whether the execution environment corresponding to the login request is the WeChat environment; If the execution environment is a WeChat environment, obtaining a login request initiated by the user in the target official account; If the execution environment is not the WeChat environment, generate environment prompt information.

5. The method according to any one of claims 1 to 3, characterized in that If the token corresponding to the target official account is not obtained, the method further includes: Determine whether the page the user is about to enter is a page that requires login; If a login page is required, jump to the login page to obtain the token corresponding to the target official account based on the login page; If the login page is not required, jump to the page the user is about to enter.

6. The method according to claim 5, characterized in that If a login page is required, jump to the login page to obtain the token corresponding to the target official account based on the login page, including: If a login page is required, jump to the login page and obtain rspCode from the address bar. The rspCode is a response status parameter indicating the login request. If the value of the rspCode is 00, the token obtained from the address bar is determined as the token corresponding to the target official account; If the value of the rspCode is not 00, the user's login information is obtained to obtain the token corresponding to the target public account based on the login information.

7. The method according to any one of claims 1 to 3, characterized in that After successfully logging into the target public account, the method further includes: Determining whether the user has undergone real-name authentication; If the user has not performed real-name authentication, real-name authentication is performed on the user.

8. A multi-official account joint login device, characterized in that: include: A login request acquisition module is used to acquire a login request initiated by a user on a target official account, wherein the login request includes the official account identifier of the target official account, and the target official account is any one of multiple official accounts of the same account owner in WeChat; A token acquisition module is used to obtain the token corresponding to the target official account according to the official account identifier of the target official account; A first judgment module is used to determine whether the user has successfully logged into the target official account after obtaining the token corresponding to the target official account; The second judgment module is used to obtain the user's UnionID in WeChat if the token corresponding to the target official account is not obtained, and successfully log in to the target official account based on the UnionID. The UnionID is used to represent the user's identity in WeChat, and the UnionID is associated with multiple official accounts corresponding to the user.

9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.