A method and apparatus for logging into an application account
By redirecting to the webpage view routing page within the WeChat Mini Program, and obtaining and processing HTML5 link parameters, the data isolation problem between the native WeChat Mini Program page and the web-view component is solved, enabling the sharing of login information, improving user experience, and reducing redundant development.
Patent Information
- Application Number
- CN202310772296.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-28
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2043-06-28
AI Technical Summary
The inability of native pages and web-view components in WeChat mini programs to share data forces users to log in repeatedly, impacting user experience and wasting development resources.
By navigating from the application's native page to the webpage view routing page, HTML5 link parameters are obtained, the account login status is determined, and login operations are performed when necessary, enabling the sharing of login information.
It enables seamless sharing of login information between native and HTML5 pages, reducing redundant development and improving user experience.
Smart Images

Figure CN116668168B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to an application account login method and apparatus. Background Technology
[0002] The native pages of WeChat Mini Programs and HTML5 pages opened using the web-view component cannot share data. Therefore, after logging into a WeChat Mini Program, the login information of the WeChat Mini Program cannot be used by the HTML5 pages inside the web-view component container.
[0003] Because the native pages and web-view components of WeChat Mini Programs are relatively isolated, data cannot be shared. This means that even if a user is already logged into the WeChat Mini Program, their user information cannot be retrieved when opening the HTML5 page, requiring them to log in again. This disrupts the program's integrity, resulting in a poor user experience and potentially causing users to leave the page, leading to user churn. Secondly, because data is not shared between the native pages and web-view components, two separate login pages are required for the HTML5 page and the native WeChat Mini Program page, wasting development resources and negatively impacting the user experience.
[0004] Since WeChat Mini Programs introduced the web-view component, many developers have integrated their existing business logic into WeChat Mini Programs. This reduces repetitive development time and expands business channels. However, enabling seamless login between the native WeChat Mini Program page and the embedded HTML5 page has become a critical issue. Using the original HTML5 login page would create a disconnect with the native WeChat Mini Program login page, leading to inconsistent login states. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention proposes an application account login method and apparatus.
[0006] To achieve the above objectives, the technical solution adopted by the present invention includes:
[0007] An application account login method includes the following steps:
[0008] Navigate from the application's native page to the application's web view routing page;
[0009] In the webpage view routing page, HTML5 link parameters are obtained from the onLoad lifecycle function;
[0010] Determine whether it is necessary to log in to the application's account based on the HTML5 link parameters;
[0011] If the account does not need to be logged in, the HTML5 link parameter is assigned to the webpage view component to enter the HTML5 page;
[0012] If it is necessary to log in to the account, determine the login status of the account;
[0013] Perform the corresponding login operation based on the account's login status, and enter the HTML5 page.
[0014] Furthermore, determining the login status of the account includes detecting the login status of the account in the local cache of the application. If the account is detected as logged in in the local cache, the account is determined to be logged in; if the account is not detected as logged in in the local cache, the account is determined to be logged out.
[0015] Furthermore, when the account is already logged in, the method further includes:
[0016] Retrieve the login information of the account from the application's local cache;
[0017] The login information is encrypted and appended to the HTML5 link parameters to obtain the encrypted HTML5 link parameters;
[0018] The encrypted HTML5 link parameters are assigned to the webpage view component to enter the HTML5 page.
[0019] Furthermore, the method also includes:
[0020] The encrypted HTML5 link parameters are obtained, decrypted, and stored in the local cache.
[0021] Furthermore, when the account is not logged in, the method further includes:
[0022] Obtain the HTML5 link parameters and redirect to the application's native page;
[0023] Obtain account login information and perform account login operation to enter the HTML5 page;
[0024] The login information is stored in the local cache.
[0025] The present invention also relates to an application account login device, comprising:
[0026] The module retrieves HTML5 link parameters from the application's native page to the application's web view routing page; within the web view routing page, it retrieves the HTML5 link parameters from the onLoad lifecycle function.
[0027] The judgment module determines whether it is necessary to log in to the application's account based on the HTML5 link parameters;
[0028] If the execution module does not require the account to be logged in, it assigns the HTML5 link parameter to the webpage view component and enters the HTML5 page; if the account needs to be logged in, it determines the login status of the account and performs the corresponding login operation according to the login status of the account, and enters the HTML5 page.
[0029] The present invention also relates to a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0030] The present invention also relates to an electronic device, including a processor and a memory;
[0031] The memory is used to store operation instructions;
[0032] The processor is configured to execute the above-described method by invoking the operation instructions.
[0033] The present invention also relates to a computer program product, including a computer program and / or instructions, characterized in that the computer program and / or instructions, when executed by a processor, implement the steps of the above-described method.
[0034] The beneficial effects of this invention are as follows:
[0035] This invention discloses an application account login method and apparatus. The method includes navigating from the application's native page to the application's web view routing page; retrieving HTML5 link parameters from the onLoad lifecycle function in the web view routing page; determining whether login to the application's account is required based on the HTML5 link parameters; assigning the HTML5 link parameters to a web view component if login is not required, and entering the HTML5 page; determining the login status of the account if login is required; and performing a corresponding login operation based on the login status, and entering the HTML5 page. This method enables login information sharing between the application's native page and the HTML5 page accessed through the application's web view routing page; furthermore, both share a single native login page, reducing redundant development and improving the user experience. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of the application account login method provided in an embodiment of the present invention.
[0037] Figure 2This is a schematic diagram of the application account login device provided in an embodiment of the present invention. Detailed Implementation
[0038] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0039] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0040] It is worth noting that the data collection and transfer activities involved in this application have all been with the user's consent and are necessary for the applicant's normal business activities. Furthermore, the applicant has anonymized and desensitized the collected data and set corresponding access permissions to ensure that user privacy is not leaked. The data compliance measures involved in this application are only listed here; the applicant has also implemented other relevant data compliance measures. The data processing activities carried out by the applicant comply with the provisions of the Data Security Law and the Personal Information Protection Law, and other relevant laws and regulations.
[0041] The first aspect of this invention relates to a process flow as follows: Figure 1 The application account login method shown includes the following steps:
[0042] Step S1: The user is redirected from the application's native page to the application's web view routing page.
[0043] In this embodiment, the application is preferably a WeChat mini program; the webpage view routing page is a web-view routing page.
[0044] Step S2: In the webpage view routing page, obtain the HTML5 link parameters from the onLoad lifecycle function.
[0045] Step S3: Determine whether it is necessary to log in to the application's account based on the HTML5 link parameters.
[0046] Step S4: If logging into the account is not required, assign the HTML5 link parameter to the webpage view component and enter the HTML5 page.
[0047] Step S5: If it is necessary to log in to the account, determine the login status of the account, perform the corresponding login operation according to the login status of the account, and enter the HTML5 page.
[0048] The step of determining the login status of the account includes detecting the login status of the account in the local cache of the application. If the account is detected as logged in in the local cache, the account is determined to be logged in; if the account is not detected as logged in in the local cache, the account is determined to be logged out.
[0049] When it is determined that the account is already logged in, the method specifically includes:
[0050] Retrieve the login information of the account from the application's local cache;
[0051] The login information is encrypted and appended to the HTML5 link parameters to obtain the encrypted HTML5 link parameters;
[0052] The encrypted HTML5 link parameters are assigned to the webpage view component to enter the HTML5 page;
[0053] The encrypted HTML5 link parameters are obtained, decrypted, and stored in the local cache.
[0054] For example, the specific implementation steps are as follows:
[0055] (1) Retrieve login information such as login token from local cache;
[0056] (2) Convert JSON to a string using JSON.stringify, then URL encode it, and finally encrypt it using base64 before appending it to the HTML5 link parameters and passing it to the HTML5 page as an HTML5 link parameter.
[0057] (3) Assign the processed HTML5 link parameters to the web-view component, and then enter the HTML5 page;
[0058] (4) Extract the parameters from the connection in the HTML5 page using js, perform base64 decryption and URL decode, and finally obtain the token and other login information and store them locally for use in subsequent requests to the backend interface.
[0059] When it is determined that the account is not logged in, the method specifically includes:
[0060] Obtain the HTML5 link parameters and redirect to the application's native page;
[0061] Obtain account login information and perform account login operation to enter the HTML5 page;
[0062] The login information is stored in the local cache.
[0063] For example, the specific implementation steps are as follows:
[0064] (1) Use the wx.redirectTo method (a method provided by WeChat Mini Program to close the current page and redirect to other pages) to redirect to the WeChat Mini Program native joint login page with the parameters of the current route. Users can choose to log in by authorizing their mobile phone number or manually entering their mobile phone number / verification code.
[0065] (2) After successful login, store the login status data returned by the backend interface in the local cache, and finally use the wx.redirectTo method to redirect to the web-view route page with the parameters of the current route;
[0066] (3) Repeat the process of step S1.
[0067] This invention discloses an application account login method and apparatus. The method includes navigating from the application's native page to the application's web view routing page; retrieving HTML5 link parameters from the onLoad lifecycle function in the web view routing page; determining whether login to the application's account is required based on the HTML5 link parameters; assigning the HTML5 link parameters to a web view component if login is not required, and entering the HTML5 page; determining the login status of the account if login is required; and performing a corresponding login operation based on the login status, and entering the HTML5 page. This method enables login information sharing between the application's native page and the HTML5 page accessed through the application's web view routing page; furthermore, both share a single native login page, reducing redundant development and improving the user experience.
[0068] Another aspect of the present invention relates to an application account login device, the structure of which is as follows: Figure 2As shown, it includes:
[0069] The module retrieves HTML5 link parameters from the application's native page to the application's web view routing page; within the web view routing page, it retrieves the HTML5 link parameters from the onLoad lifecycle function.
[0070] The judgment module determines whether it is necessary to log in to the application's account based on the HTML5 link parameters;
[0071] If the execution module does not require the account to be logged in, it assigns the HTML5 link parameter to the webpage view component and enters the HTML5 page; if the account needs to be logged in, it determines the login status of the account and performs the corresponding login operation according to the login status of the account, and enters the HTML5 page.
[0072] By using this device, the above-mentioned computational processing methods can be executed and the corresponding technical effects can be achieved.
[0073] Embodiments of the present invention also provide a computer-readable storage medium capable of implementing all the steps of the methods in the above embodiments, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, implements all the steps of the methods in the above embodiments.
[0074] Embodiments of the present invention also provide an electronic device for performing the above-described method. As an implementation device for the method, the electronic device includes at least a processor and a memory. In particular, the memory stores data and related computer programs required for performing the method. The processor calls the data and programs in the memory to execute all the steps of the method and obtain the corresponding technical effect.
[0075] Preferably, the electronic device may include a bus architecture, which may include any number of interconnected buses and bridges. The bus will include various circuits linked together by one or more processors and memories. The bus may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface between the bus and the receiver and transmitter. The receiver and transmitter may be the same element, i.e., a transceiver, providing a unit for communicating with various other systems over a transmission medium. The processor is responsible for managing the bus and general processing, while the memory may be used to store data used by the processor during operation.
[0076] Additionally, the electronic device may further include components such as a communication module, an input unit, an audio processor, a display, and a power supply. The processor (or controller, operating control) used may include a microprocessor or other processor device and / or logic device, which receives input and controls the operation of various components of the electronic device; the memory may be one or more of a buffer, flash memory, hard drive, removable media, volatile memory, non-volatile memory, or other suitable devices, which can store the aforementioned data information, and may also store programs for executing the information, and the processor can execute the program stored in the memory to achieve information storage or processing, etc.; the input unit is used to provide input to the processor, for example, it can be a button or touch input device; the power supply is used to provide power to the electronic device; the display is used to display images and text, for example, it can be an LCD display. The communication module is a transmitter / receiver that transmits and receives signals via an antenna. The communication module (transmitter / receiver) is coupled to the processor to provide input signals and receive output signals, which can be the same as in conventional mobile communication terminals. Based on different communication technologies, multiple communication modules can be incorporated into the same electronic device, such as cellular network modules, Bluetooth modules, and / or wireless LAN modules. The communication module (transmitter / receiver) is also coupled to a speaker and microphone via an audio processor to provide audio output through the speaker and receive audio input from the microphone, thereby enabling typical telecommunications functions. The audio processor can include any suitable buffer, decoder, amplifier, etc. Furthermore, the audio processor is coupled to a central processing unit, enabling on-device recording via the microphone and on-device playback of stored sound via the speaker.
[0077] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0078] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A system that specifies functions in one or more boxes.
[0079] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction set implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0080] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the functions specified in one or more boxes. Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the invention.
[0081] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for logging into an application account, characterized in that, Includes the following steps: Navigate from the application's native page to the application's web view routing page; In the webpage view routing page, HTML5 link parameters are obtained from the onLoad lifecycle function; Determine whether it is necessary to log in to the application's account based on the HTML5 link parameters; If the account does not need to be logged in, the HTML5 link parameter is assigned to the webpage view component to enter the HTML5 page; If it is necessary to log in to the account, determine the login status of the account; Perform the corresponding login operation based on the login status of the account, and enter the HTML5 page; Determining the login status of the account includes detecting the login status of the account in the local cache of the application. If the account is detected as logged in in the local cache, then the account is determined to be logged in. If the login status of the account is not detected in the local cache, the account is determined to be in an unlogged-in state. When the account is already logged in, the method further includes: Retrieve the login information of the account from the application's local cache; The login information is encrypted and appended to the HTML5 link parameters to obtain the encrypted HTML5 link parameters; The encrypted HTML5 link parameters are assigned to the webpage view component to enter the HTML5 page; The encrypted HTML5 link parameters are obtained, decrypted, and stored in the local cache; Specifically, the login token login information is retrieved from the local cache, converted to a string using JSON.stringify, then URL-encoded, and finally encrypted using base64 and appended to the HTML5 link parameters, which are then passed to the HTML5 page as HTML5 link parameters. Assign the processed HTML5 link parameters to the web-view component, and then enter the HTML5 page; In the HTML5 page, parameters from the link are extracted using JavaScript, and then base64 decryption and URL decoding are performed to obtain the token login information.
2. The method as described in claim 1, characterized in that, When the account is not logged in, the method further includes: Obtain the HTML5 link parameters and redirect to the application's native page; Obtain account login information and perform account login operation to enter the HTML5 page; The login information is stored in the local cache.
3. An application account login device, characterized in that, The apparatus is used to implement the method according to any one of claims 1 to 2, comprising: The module retrieves HTML5 link parameters from the application's native page and redirects to the application's web view routing page; within the web view routing page, it retrieves the HTML5 link parameters from the onLoad lifecycle function. The judgment module determines whether it is necessary to log in to the application's account based on the HTML5 link parameters; If the execution module does not require the account to be logged in, it assigns the HTML5 link parameter to the webpage view component and enters the HTML5 page; if the account needs to be logged in, it determines the login status of the account and performs the corresponding login operation according to the login status of the account, and enters the HTML5 page.
4. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method of any one of claims 1 to 2.
5. An electronic device, characterized in that, Including processor and memory; The memory is used to store operation instructions; The processor is configured to execute the method of any one of claims 1 to 2 by invoking the operation instructions.
6. A computer program product, comprising a computer program and / or instructions, characterized in that, When the computer program and / or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 2.
Citation Information
Patent Citations
Webpage login method and device
CN116127435A