Method and device for parallel online operation and testing and debugging of authorization process

By configuring the online address U in the callback address configuration item of the social media platform, adding the test_url field and the judgment function Fp in the browser's localStorage, the problems of inconvenient callback address maintenance and poor user experience in the authorization process of the social media platform are solved, and flexible environment switching and efficient development and debugging are achieved.

CN119621594BActive Publication Date: 2025-09-26ONE NETWORK INTEROPERABILITY (BEIJING) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411788652.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-09-26
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

The authorization process of social media platforms in the prior art has problems such as inconvenient callback address maintenance, poor user experience and high development costs during development and debugging.

Method used

By configuring the online address U in the callback address configuration item of the social media platform, adding the test_url field in the browser's localStorage, and adding the judgment function Fp to the callback address of the online project, flexible switching between the online environment and the test environment can be achieved. The window.open method is used for secondary callback, and parameters are obtained in the test environment for operation.

Benefits of technology

It enables flexible environment switching, reduces development costs, improves development efficiency, ensures the stability of the online environment and user experience, and enhances system security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621594B_ABST
    Figure CN119621594B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide a method, device, and electronic device for parallel online execution and testing and debugging of an authorization process, belonging to the field of data processing technology. The method comprises: configuring an online address U in a callback address configuration item provided by a social media platform; adding a field named test_url to the browser localStorage of the online project during development and debugging in a test environment; adding a judgment function Fp to the callback address corresponding to the online project; obtaining a parameter P carried in the redirection address bar from the online environment on the page corresponding to test_url in the test environment, and pulling the homepage based on the parameter P carried in the address bar; and manually deleting the test_url field in the browser localStorage corresponding to the online project after debugging in the test environment is completed. The present invention can improve the development efficiency of social media authorization programs by running authorization processes in parallel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method, device and electronic equipment for parallel online operation and testing and debugging of an authorization process. Background Art

[0002] The authorization process for a social media platform's homepage refers to the process by which a user authorizes an application to access their social media account so that the application can perform specific actions on the user's behalf, such as obtaining user information and posting content. The user clicks the "Login" or "Connect to Social Media" button in the application, triggering an authorization request. The application redirects the user to the social media platform's authorization page, which displays a dialog box asking the user to authorize the application to access certain permissions on their account. This dialog box typically contains parameters such as client_id (the application's unique identifier), redirect_uri (the URL to be called back after successful authorization), response_type (response type, usually code), scope (the scope of the requested permission, such as email, public_profile, etc.), and state (a random string used to prevent CSRF attacks).

[0003] The existing technology has the following flaws in the development of the authorization process for social media platform homepages:

[0004] 1. The authorization process for a social media platform homepage requires specifying a callback address in the platform's backend. Some social media platforms offer multiple apps for binding different callback addresses, but this requires maintaining multiple apps simultaneously. Some platforms only offer one app and can only bind to one callback address. This creates inconvenience when debugging in the development environment after the service is launched.

[0005] 2. Some social media platforms have complex authorization screens, which can confuse users and make them unclear about the specifics of authorization, impacting the user experience. Frequent authorization requests can annoy users and lead to them canceling their authorization requests. When users decline authorization or authorization fails, the app should provide friendly error messages and recovery mechanisms to prevent potential user churn.

[0006] The above problems become technical problems that need to be solved. Summary of the Invention

[0007] In view of this, embodiments of the present invention provide a method, apparatus, and electronic device for parallel online operation and testing and debugging of an authorization process, which at least partially solve the problems existing in the prior art.

[0008] In a first aspect, an embodiment of the present invention provides a method for concurrently running an authorization process online and testing and debugging, comprising:

[0009] Configure an online address U in the callback address configuration item provided by the social media platform. The online address U is used to receive callback data from the social media platform and process authorization operations.

[0010] When developing and debugging in the test environment, add a field named test_url to the localStorage of the online project's browser. The value of the test_url field is the address T of the test environment, which is used to redirect the callback process to the test environment.

[0011] Add a judgment function Fp to the callback address corresponding to the online project. The judgment function Fp is used to check whether there is a field named test_url in the browser's localStorage. If the test_url field exists, the normal online authorization operation process is stopped, the search parameter P carried in the callback return of the social media platform is intercepted, and the search parameter P is concatenated with test_url to form a new callback link L = T + '?' + P. Use the window.open method to open the concatenated test_url link L for a second callback;

[0012] In the test environment, the page corresponding to test_url obtains the parameter P carried in the redirection address bar from the online environment, and pulls the homepage based on the parameter P carried in the address bar;

[0013] After debugging in the test environment is completed, manually delete the test_url field in the browser localStorage corresponding to the online project.

[0014] According to a specific implementation of an embodiment of the present invention, configuring an online address U in the callback address configuration item provided by the social media platform includes:

[0015] Write an API endpoint on the server to receive callback data sent by the social media platform, verify the callback parameters, obtain an access token, and save user information in the API endpoint.

[0016] According to a specific implementation of an embodiment of the present invention, configuring an online address U in the callback address configuration item provided by the social media platform further includes:

[0017] Enter the online address U in the configuration item of the developer console of the social media platform;

[0018] After the user completes the authorization through the social media platform, they obtain the authorization code returned by the platform;

[0019] Use the received authorization code to call the social media platform's API in exchange for the user's access token.

[0020] According to a specific implementation of an embodiment of the present invention, when developing and debugging in a test environment, a field named test_url is added to the localStorage of the browser of the online project, including:

[0021] In the developer tools, find and switch to the Application tab;

[0022] Add a new key-value pair in the localStorage panel list corresponding to the Application tag. The key name is test_url and the value is the test environment address T.

[0023] According to a specific implementation of an embodiment of the present invention, the step of adding a judgment function Fp to the callback address corresponding to the online project includes:

[0024] Add JS code to the page corresponding to the callback address, and add the interrupt function Fp in the JS code.

[0025] According to a specific implementation of an embodiment of the present invention, the use of the window.open method to open the spliced ​​test_url link L for secondary callback includes:

[0026] Using the window.open method to open the concatenated test_url link L will cause the browser to navigate to the new URL and redirect the user to the callback page of the test environment;

[0027] By setting the second parameter of the window.open method to _self, a new callback link L is opened in the current window.

[0028] According to a specific implementation of an embodiment of the present invention, obtaining the parameter P carried in the redirected address bar from the online environment from the page corresponding to test_url in the test environment, and pulling the homepage based on the parameter P carried in the address bar, includes:

[0029] Extract the query string portion from the URL in the address bar, extract the key-value pairs in the string based on the delimiter contained in the string, and use the extracted key-value pairs as the parameter P carried in the address bar.

[0030] According to a specific implementation of an embodiment of the present invention, the operation of obtaining the parameter P carried in the redirected address bar from the online environment on the page corresponding to test_url in the test environment, and pulling the homepage based on the parameter P carried in the address bar, further includes:

[0031] In the console, use the code parameter to obtain an access token, and use the access token to pull the home page content.

[0032] In a second aspect, an embodiment of the present invention provides a device for running an authorization process online and performing testing and debugging in parallel, including:

[0033] The configuration module configures an online address U in the callback address configuration item provided by the social media platform. The online address U is used to receive callback data from the social media platform and process authorization operations.

[0034] Add a module. When developing and debugging in the test environment, add a field named test_url to the localStorage of the online project's browser. The value of the test_url field is the address T of the test environment, which is used to redirect the callback process to the test environment.

[0035] In the judgment module, a judgment function Fp is added to the callback address corresponding to the online project. The judgment function Fp is used to check whether a field named test_url exists in the browser's localStorage. If the test_url field exists, the normal online authorization operation process is stopped, the search parameter P carried in the callback return of the social media platform is intercepted, and the search parameter P is concatenated with test_url to form a new callback link L = T + '?' + P. The concatenated test_url link L is opened using the window.open method for a second callback.

[0036] The targeting module obtains the parameter P carried in the redirection address bar from the online environment in the page corresponding to test_url in the test environment, and pulls the homepage based on the parameter P carried in the address bar;

[0037] Delete the module. After debugging in the test environment is completed, manually delete the test_url field in the browser localStorage corresponding to the online project.

[0038] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0039] at least one processor; and,

[0040] a memory communicatively connected to the at least one processor; wherein,

[0041] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of parallel online operation and testing and debugging of the authorization process in any of the aforementioned first aspects or any implementation of the first aspect.

[0042] In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the method of online running of the authorization process and parallel testing and debugging in the aforementioned first aspect or any implementation of the first aspect.

[0043] In the fifth aspect, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the method of online running of the authorization process and parallel testing and debugging in the aforementioned first aspect or any implementation of the first aspect.

[0044] The scheme for running the authorization process online and testing and debugging in parallel in the embodiment of the present invention includes: configuring an online address U in the callback address configuration item provided by the social media platform, and the online address U is used to receive callback data from the social media platform and process the authorization operation; when developing and debugging in the test environment, adding a field named test_url to the browser localStorage of the online project, and the value of the test_url field is the address T of the test environment, which is used to indicate that the callback process is redirected to the test environment; adding a judgment function Fp to the callback address corresponding to the online project, and the judgment function Fp is used to check whether there is a field named test_url in the browser localStorage, and if it exists, If the test_url field is not found, the normal online authorization process is stopped, the search parameter P carried in the callback return from the social media platform is intercepted, and the search parameter P is concatenated with test_url to form a new callback link L = T + '?' + P. The concatenated test_url link L is opened using the window.open method for a second callback. In the test environment, the page corresponding to test_url obtains the parameter P carried in the redirected address bar from the online environment and pulls the homepage based on the parameter P carried in the address bar. After debugging in the test environment is completed, the test_url field in the browser localStorage corresponding to the online project is manually deleted. This solution has the following beneficial effects:

[0045] 1. Flexible environment switching: By adding the test_url field in localStorage, you can easily switch the callback process from the online environment to the test environment without modifying the backend configuration, which improves the flexibility of development and debugging.

[0046] 2. Reduce development costs: There is no need to configure a callback address separately for the test environment, which reduces the workload of configuration and management and reduces development costs.

[0047] 3. Maintain a stable online environment: During debugging in a test environment, the normal authorization process of the online environment will not be affected, ensuring the normal use and experience of online users.

[0048] 4. Rapid iteration and debugging: Developers can quickly iterate and debug the authorization process in a test environment, improving development efficiency and shortening the development cycle.

[0049] 5. Easy to manage and maintain: The callback process is controlled through simple localStorage operations, making environment switching and management simpler and more intuitive, and easy to maintain.

[0050] 6. Enhanced security: Controlling environment switching through localStorage avoids confusion of sensitive information in different environments and enhances system security. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0052] Figure 1 A flowchart of a method for parallel online operation and testing and debugging of an authorization process provided by an embodiment of the present invention;

[0053] Figure 2 A flowchart of another method for parallel online execution and testing and debugging of an authorization process provided by an embodiment of the present invention;

[0054] Figure 3 A schematic diagram of the structure of a device for online operation and parallel testing and debugging of an authorization process provided by an embodiment of the present invention;

[0055] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0056] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0057] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.

[0058] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on this disclosure, it should be understood by those skilled in the art that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects described herein can be used to implement an apparatus and / or practice a method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this apparatus and / or practice this method.

[0059] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The illustrations only show components related to the present disclosure and are not drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component can be changed at will, and the component layout type may also be more complicated.

[0060] Additionally, in the following description, specific details are provided to provide a thorough understanding of the examples. However, one skilled in the art will appreciate that the aspects described can be practiced without these specific details.

[0061] The disclosed embodiments provide a method for concurrently running an authorization process online and testing and debugging. The method provided in this embodiment can be performed by a computing device, which can be implemented as software or a combination of software and hardware. The computing device can be integrated into a server, terminal device, or the like.

[0062] See also Figure 1 and Figure 2 The present disclosure provides a method for running an authorization process online and performing testing and debugging in parallel, including:

[0063] S101: Configure an online address U in the callback address configuration item provided by the social media platform. The online address U is used to receive callback data from the social media platform and process authorization operations.

[0064] Configure an online address U in the callback address configuration item provided by the social media platform to receive callback data from the social media platform and process authorization operations. This usually involves the following steps:

[0065] Set up a publicly accessible server to deploy your application. This server needs to be able to receive HTTP requests from the social media platform. Create an API endpoint on the server (for example, / auth / callback) that will receive the callback data sent by the social media platform. Implement the logic for handling the authorization response in this endpoint, such as validating callback parameters, obtaining an access token, and saving user information.

[0066] Go to the developer console of your social media platform and navigate to the app management section. In the app settings, find the "Callback URL" or "Redirect URI" configuration option. Enter the URL you prepared (for example, https: / / yourdomain.com / auth / callback).

[0067] After a user completes authorization through the social media platform, the platform redirects them to the configured callback URL U along with parameters such as the authorization code and state. On the server side, the validity of these parameters, especially the state, must be verified to prevent CSRF attacks. Using the received authorization code, the social media platform's API is called in exchange for an access token. The access token can be used to retrieve basic user information and save it to a database for later use.

[0068] Through the above steps, you can successfully configure an online address U in the callback address configuration item provided by the social media platform to receive callback data from the social media platform and process authorization operations.

[0069] S102, when developing and debugging in the test environment, add a field named test_url to the localStorage of the browser of the online project. The value of the test_url field is the address T of the test environment, which is used to instruct the callback process to redirect to the test environment.

[0070] You can use a browser that supports developer tools (such as Chrome, Firefox, Safari, etc.) to open the web page of the online project.

[0071] In the developer tools, find and switch to the "Application" or "Storage" tab. This tab typically contains storage information for localStorage, sessionStorage, Cookies, and more. Under the "Application" or "Storage" tab, find the localStorage option. There's usually a drop-down list where you can select the domain name of your live project.

[0072] In the localStorage panel, you'll see a list of key-value pairs. Click the "+" button or directly add a new key-value pair in the list. For the Key, enter test_url , and for the Value, enter the test environment URL T , for example, http: / / test.yourdomain.com / callback .

[0073] Through the above steps, you can successfully add the test_url field to the browser localStorage without writing any code, which is used to instruct the callback process to redirect to the test environment.

[0074] S103: Add a judgment function Fp to the callback address corresponding to the online project. The judgment function Fp is used to check whether there is a field named test_url in the browser's localStorage. If the test_url field exists, the normal online authorization operation process is stopped, and the search parameter P carried by the callback return of the social media platform is intercepted. The search parameter P is spliced ​​to test_url to form a new callback link L=T+'?'+P. Use the window.open method to open the spliced ​​test_url link L for a second callback.

[0075] Specifically, you can find and switch to the "Console" tab in the developer tools. This tab is used to run JavaScript code and view output information.

[0076] In the Console tab, you can write and run a JavaScript function to implement the required logic to achieve the following functions:

[0077] 1. Check if the test_url field exists in localStorage

[0078] You can use localStorage.getItem('test_url') to check whether the test_url field exists.

[0079] 2. If the test_url field exists:

[0080] Stop the normal online authorization process and obtain the search parameter (query string) in the URL.

[0081] After concatenating the search parameter to test_url, a new callback link L is formed. Use the window.open method to open the new callback link L for a secondary callback.

[0082] 3. If the test_url field does not exist: Continue with the normal online authorization process.

[0083] By following these steps, you can add a judgment function Fp to the callback address corresponding to the online project without writing any code, and handle the callback process based on the test_url field in localStorage.

[0084] S104: Obtain the parameter P carried in the redirected address bar from the online environment from the page corresponding to test_url in the test environment, and pull the homepage based on the parameter P carried in the address bar.

[0085] In the developer tools, you can switch to the "Network" tab, which is used to view network requests.

[0086] In the request details, check the URL's query string (i.e., search parameters). These parameters are the parameters P carried in the address bar when redirecting back from the online environment. In the browser's address bar, you can see the complete URL, including the query string. For example:

[0087] http: / / test.yourdomain.com / callback?code=abc123&state=xyz789

[0088] Manually extract the parameters in the query string, such as code=abc123 and state=xyz789.

[0089] In the "Console" tab of the developer tools, you can run JavaScript code to use the extracted parameters to pull the home page.

[0090] S105, after the debugging work in the test environment is completed, manually delete the test_url field in the browser localStorage corresponding to the online project.

[0091] You can find the localStorage option under the "Application" or "Storage" tab. There will usually be a drop-down list to select the domain name of your online project. In the localStorage panel, you will see a list of key-value pairs. Find the entry with the key name test_url. Right-click the test_url entry and select the "Delete" option. Alternatively, you can directly click the value part of the test_url entry, delete its content, and press Enter to save.

[0092] By following the above steps, you can manually delete the test_url field in the browser localStorage corresponding to the online project without writing any code.

[0093] According to a specific implementation of an embodiment of the present invention, configuring an online address U in the callback address configuration item provided by the social media platform includes:

[0094] Write an API endpoint on the server to receive callback data sent by the social media platform, verify the callback parameters, obtain an access token, and save user information in the API endpoint.

[0095] According to a specific implementation of an embodiment of the present invention, configuring an online address U in the callback address configuration item provided by the social media platform further includes:

[0096] Enter the online address U in the configuration item of the developer console of the social media platform;

[0097] After the user completes the authorization through the social media platform, they obtain the authorization code returned by the platform;

[0098] Use the received authorization code to call the social media platform's API in exchange for the user's access token.

[0099] According to a specific implementation of an embodiment of the present invention, when developing and debugging in a test environment, a field named test_url is added to the localStorage of the browser of the online project, including:

[0100] In the developer tools, find and switch to the Application tab;

[0101] Add a new key-value pair in the localStorage panel list corresponding to the Application tag. The key name is test_url and the value is the test environment address T.

[0102] According to a specific implementation of an embodiment of the present invention, the step of adding a judgment function Fp to the callback address corresponding to the online project includes:

[0103] Add JS code to the page corresponding to the callback address, and add the interrupt function Fp in the JS code.

[0104] According to a specific implementation of an embodiment of the present invention, the use of the window.open method to open the spliced ​​test_url link L for secondary callback includes:

[0105] Using the window.open method to open the concatenated test_url link L will cause the browser to navigate to the new URL and redirect the user to the callback page of the test environment;

[0106] By setting the second parameter of the window.open method to _self, a new callback link L is opened in the current window.

[0107] According to a specific implementation of an embodiment of the present invention, obtaining the parameter P carried in the redirected address bar from the online environment from the page corresponding to test_url in the test environment, and pulling the homepage based on the parameter P carried in the address bar, includes:

[0108] Extract the query string portion from the URL in the address bar, extract the key-value pairs in the string based on the delimiter contained in the string, and use the extracted key-value pairs as the parameter P carried in the address bar.

[0109] According to a specific implementation of an embodiment of the present invention, the operation of obtaining the parameter P carried in the redirected address bar from the online environment on the page corresponding to test_url in the test environment, and pulling the homepage based on the parameter P carried in the address bar, further includes:

[0110] In the console, use the code parameter to obtain an access token, and use the access token to pull the home page content.

[0111] Corresponding to the above method embodiment, see Figure 3 The embodiment of the present invention further discloses a device 30 for running authorization processes online and performing testing and debugging in parallel, comprising:

[0112] Configuration module 301 configures an online address U in the callback address configuration item provided by the social media platform, where the online address U is used to receive callback data from the social media platform and process authorization operations;

[0113] Adding module 302, when developing and debugging in the test environment, adds a field named test_url to the localStorage of the browser of the online project. The value of the test_url field is the address T of the test environment, which is used to indicate that the callback process is redirected to the test environment;

[0114] Judgment module 303 adds a judgment function Fp to the callback address corresponding to the online project. The judgment function Fp is used to check whether a field named test_url exists in the browser's localStorage. If the test_url field exists, the normal online authorization operation process is stopped, the search parameter P carried in the callback return of the social media platform is intercepted, and the search parameter P is concatenated with test_url to form a new callback link L = T + '?' + P. The concatenated test_url link L is opened using the window.open method for a second callback.

[0115] The targeting module 304 obtains the parameter P carried in the redirection address bar from the online environment in the page corresponding to test_url in the test environment, and pulls the homepage based on the parameter P carried in the address bar;

[0116] Deletion module 305, after the debugging work in the test environment is completed, manually deletes the test_url field in the browser localStorage corresponding to the online project.

[0117] See also Figure 4 The embodiment of the present invention further provides an electronic device 60, which includes:

[0118] at least one processor; and,

[0119] a memory communicatively connected to the at least one processor; wherein,

[0120] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to execute the method of authorizing the online operation of the process and testing and debugging in parallel in the aforementioned method embodiment.

[0121] An embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores computer instructions. The computer instructions are used to enable the computer to execute the aforementioned method embodiment.

[0122] An embodiment of the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the method of parallel online operation of the authorization process and testing and debugging in the aforementioned method embodiment.

[0123] Reference below Figure 4 , which shows a schematic structural diagram of an electronic device 60 suitable for implementing an embodiment of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. 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 disclosure.

[0124] like Figure 4 As shown, electronic device 60 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 602 or programs loaded from a storage device 608 into a random access memory (RAM) 603. Various programs and data required for the operation of electronic device 60 are also stored in RAM 603. Processing device 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to bus 604.

[0125] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, a gage, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 60 to communicate with other devices wirelessly or by wire to exchange data. Figure 4 The electronic device 60 is shown with various devices, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.

[0126] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.

[0127] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A method for parallel online operation and testing and debugging of authorization processes, characterized in that: include: Configure an online address U in the callback address configuration item provided by the social media platform. The online address U is used to receive callback data from the social media platform and process authorization operations. When developing and debugging in the test environment, add a field named test_url to the localStorage of the online project's browser. The value of the test_url field is the address T of the test environment, which is used to redirect the callback process to the test environment. Add a judgment function Fp to the callback address corresponding to the online project. The judgment function Fp is used to check whether there is a field named test_url in the browser's localStorage. If the test_url field exists, the normal online authorization operation process is stopped, the search parameter P carried in the callback return of the social media platform is intercepted, and the search parameter P is concatenated with test_url to form a new callback link L = T + '?' + P. Use the window.open method to open the concatenated test_url link L for a second callback; In the test environment, the page corresponding to test_url obtains the parameter P carried in the redirection address bar from the online environment, and pulls the homepage based on the parameter P carried in the address bar; After debugging in the test environment is completed, manually delete the test_url field in the browser localStorage corresponding to the online project.

2. The method according to claim 1, characterized in that Configuring an online address U in the callback address configuration item provided by the social media platform includes: Write an API endpoint on the server to receive callback data sent by the social media platform, verify the callback parameters, obtain an access token, and save user information in the API endpoint.

3. The method according to claim 2, characterized in that The step of configuring an online address U in the callback address configuration item provided by the social media platform further includes: Enter the online address U in the configuration item of the developer console of the social media platform; After the user completes the authorization through the social media platform, they obtain the authorization code returned by the platform; Use the received authorization code to call the social media platform's API in exchange for the user's access token.

4. The method according to claim 3, characterized in that When developing and debugging in the test environment, add a field named test_url to the localStorage of the online project's browser, including: In the developer tools, find and switch to the Application tab; Add a new key-value pair in the localStorage panel list corresponding to the Application tag. The key name is test_url and the value is the test environment address T.

5. The method according to claim 4, characterized in that The judgment function Fp is added to the callback address corresponding to the online project, including: Add JS code to the page corresponding to the callback address, and add the interrupt function Fp in the JS code.

6. The method according to claim 5, characterized in that The window.open method is used to open the spliced ​​test_url link L for secondary callback, including: Using the window.open method to open the concatenated test_url link L will cause the browser to navigate to the new URL and redirect the user to the callback page of the test environment; By setting the second parameter of the window.open method to _self, a new callback link L is opened in the current window.

7. The method according to claim 6, characterized in that The operation of obtaining the parameter P carried in the redirected address bar from the online environment in the page corresponding to test_url in the test environment, and pulling the homepage based on the parameter P carried in the address bar, includes: Extract the query string portion from the URL in the address bar, extract the key-value pairs in the string based on the delimiter contained in the string, and use the extracted key-value pairs as the parameter P carried in the address bar.

8. The method according to claim 7, characterized in that The operation of obtaining the parameter P carried in the redirected address bar from the online environment in the page corresponding to test_url in the test environment, and pulling the homepage based on the parameter P carried in the address bar, further includes: In the console, use the code parameter to obtain an access token, and use the access token to pull the home page content.

9. A device for parallel online operation and testing and debugging of authorization processes, characterized in that: include: The configuration module configures an online address U in the callback address configuration item provided by the social media platform. The online address U is used to receive callback data from the social media platform and process authorization operations. Add a module. When developing and debugging in the test environment, add a field named test_url to the localStorage of the online project's browser. The value of the test_url field is the address T of the test environment, which is used to redirect the callback process to the test environment. In the judgment module, a judgment function Fp is added to the callback address corresponding to the online project. The judgment function Fp is used to check whether a field named test_url exists in the browser's localStorage. If the test_url field exists, the normal online authorization operation process is stopped, the search parameter P carried in the callback return of the social media platform is intercepted, and the search parameter P is concatenated with test_url to form a new callback link L = T + '?' + P. The concatenated test_url link L is opened using the window.open method for a second callback. The targeting module obtains the parameter P carried in the redirection address bar from the online environment in the page corresponding to test_url in the test environment, and pulls the homepage based on the parameter P carried in the address bar; Delete the module. After debugging in the test environment is completed, manually delete the test_url field in the browser localStorage corresponding to the online project.

10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method for parallel online operation and testing and debugging of the authorization process as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Payment platform authorization redirection method and system in cross-browser environment

    CN114331409A

  • Method and device for realizing universal mainstream media authorization homepage

    CN118041995A