WO2016101635A1 - Method, apparatus and device for synchronizing login status, and computer storage medium - Google Patents
Method, apparatus and device for synchronizing login status, and computer storage medium Download PDFInfo
- Publication number
- WO2016101635A1 WO2016101635A1 PCT/CN2015/087219 CN2015087219W WO2016101635A1 WO 2016101635 A1 WO2016101635 A1 WO 2016101635A1 CN 2015087219 W CN2015087219 W CN 2015087219W WO 2016101635 A1 WO2016101635 A1 WO 2016101635A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- session information
- login session
- login
- local
- web page
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/10—Network architectures or network communication protocols for network security for controlling access to devices or network resources
Definitions
- the present invention relates to the field of computer application technologies, and in particular, to a method, an apparatus, a device, and a computer storage medium for synchronous login status.
- the web app is an application running on a network and a standard browser and developing a specific function based on webpage technology.
- the native app is an application running based on an operating system of the smart terminal.
- Baidu company provides post bar, knows that it is a web app product, Baidu mobile guard is a native app product, many products are both web app and native app, such as Baidu map, Baidu video, etc. can be a web app product. It can also be a product of the native app.
- the implementation scheme is that the browser records the login session information of the user in a user cookie file corresponding to the system domain name of the user account, so that when the domain name is When the web page is loaded in the browser, the login session information can be directly obtained from the cookie, and the login session information is used to automatically log in. Since most operating systems maintain a separate cookie data for each application process for security reasons, the cookie data of different application processes cannot be interoperable, so the login status of the native app cannot be synchronized to other native apps. Loaded on the page.
- the present invention provides a method, apparatus, device and computer storage medium for synchronizing login status, in order to synchronize the login status of the native app to the page loaded by other native apps.
- a method for synchronizing login status comprising:
- the execution module on the web page sends a request for obtaining login session information to the local http service module;
- the local http service module After receiving the request for obtaining the login session information, the local http service module determines the local application where the login session information is located, obtains the login session information of the currently logged-in user from the local application where the login session information is located, and returns the obtained login session information to the Execution module on the web page;
- the execution module on the web page uses the login session information to perform automatic login.
- the method further includes: after the local application of the local http service module is started, initializing the local http service module to enable the local http service module to listen to a preset local network port;
- the port sends the request for obtaining login session information.
- the determining the local application where the login session information is located includes:
- the local http service module determines the local application corresponding to the application identifier information according to the application identifier information included in the request for obtaining the login session information.
- the determining that the local application where the login session information is located further includes:
- the local http service module determines the local application where the login session information is located according to the preset configuration information.
- the request for acquiring login session information includes JS callback function information
- Returning the acquired login session information to the execution module on the webpage includes: generating an execution code by using the acquired login session information and the JS callback function information, and returning the execution code to the webpage Execution module
- Performing the automatic login by the execution module on the web page by using the login session information includes: executing the execution code on the web page to complete the automatic login.
- the method before the determining the local application where the login session information is located, the method further includes:
- the local http service module determines whether the refer source address of the request for obtaining the login session information is within a preset domain name range, and if yes, continues to execute the local application where the login session information is determined; otherwise, rejects the response to the web
- the execution module on the page returns information indicating an error to the execution module on the web page.
- the method before the obtaining the login session information of the currently logged in user from the local application where the login session information is located, the method further includes:
- the local http service module determines whether the local application where the login session information is located is locally installed by calling the system interface, and if yes, continuing to execute the login application information of the current login user from the local application where the login session information is located; otherwise, Information indicating an error is returned to the execution module on the web page.
- the obtaining the login session information of the currently logged-in user from the local application where the login session information is located includes:
- the local http service module sends the session information maintenance module located in the same local application by means of intra-process communication. Requesting, and obtaining login session information of the currently logged-in user returned by the session information maintenance module; or
- the local http service module sends the local application in the local application where the login session information is located by means of inter-process communication.
- the session information maintenance module sends a request, and obtains login session information of the currently logged-in user returned by the session information maintenance module.
- the method further includes:
- the login status information and the login session information are stored in a cookie of the local application where the web page is located.
- the method before the execution module on the web page sends a request for obtaining the login session information to the local http service module, the method further includes:
- the present invention also provides an apparatus for synchronous login status, the apparatus comprising:
- An execution module on the web page configured to send a request for obtaining login session information to the local http service module when the web page is loaded; and automatically log in using the login session information returned by the local http service module;
- the local http service module is configured to: after receiving the request for obtaining the login session information, determine the local application where the login session information is located, obtain the login session information of the currently logged-in user from the local application where the login session information is located, and return the obtained login session information. Give the execution module on the web page.
- the local http service module is configured to listen to a preset local network port after being initialized by the local application
- the execution module on the webpage is specifically configured to send the request for acquiring login session information to the preset local network port.
- the local http service module when determining the local application where the login session information is located, is specifically configured to determine, according to the application identification information included in the request for obtaining the login session information, that the application identification information is corresponding. Local application.
- the local http service module is further configured to: if the request for acquiring the login session information does not include the application identification information, determine, according to the preset configuration information, the local location where the login session information is located. application.
- the specific execution is performed by using the acquired login session information and the obtaining login session information.
- JS callback function included in the request The information generation execution code returns the execution code to an execution module on the web page;
- the execution module on the web page is specifically configured to execute the execution code to complete automatic login.
- the local http service module is further configured to determine, before determining the local application where the login session information is located, whether the refer source address of the request for obtaining the login session information is within a preset domain name range, if If yes, proceed to execute the local application where the login session information is determined; otherwise, refuse to respond to the execution module on the web page or return information indicating an error to the execution module on the web page.
- the local http service module is further configured to determine, by calling the system interface, whether the local application where the login session information is located before the login session information of the currently logged in user is obtained from the local application where the login session information is located. Installed locally, if yes, continue to execute the login session information of the current login user from the local application where the login session information is located; otherwise, return information indicating the error to the execution module on the web page.
- the apparatus further includes a session information maintenance module
- the local application When the local http service module obtains the login session information of the currently logged in user from the local application where the login session information is located, the local application is: if the local application where the local http service module is located and the local application where the login session information is located is The same application sends a request to the session information maintenance module of the same local application by means of intra-process communication, and obtains login session information of the currently logged-in user returned by the session information maintenance module; or, if the local http service module The local application that is located is different from the local application where the login session information is located, and sends a request to the session information maintenance module in the local application where the login session information is located, and obtains the session information by means of inter-process communication. Wei The login session information of the currently logged in user returned by the protection module;
- the session information maintenance module is configured to: after receiving the request sent by the local http service module, return the login session information of the currently logged-in user in the local application where the session information maintenance module is located to the local http service module.
- the execution module on the web page is further configured to store the login status information and the login session information in a cookie of the local application where the web page is located after the automatic login.
- the execution module on the web page is further configured to: before sending a request for obtaining login session information to the local http service module, determining whether a cookie exists in a local application cookie of the web page. Log in to the session information, if yes, log in using the corresponding login session information in the cookie of the local application where the web page is located; otherwise, execute the request to send the login session information to the local http service module.
- the present invention can synchronize the login status of the native app to the page loaded by other native applications, as long as the native app is in the login state in the smart terminal, then when the user opens in the smart terminal and the native
- the web pages of the app belonging to the same account system domain name can be automatically logged in, reducing user operations and improving the user experience.
- FIG. 1 is a structural diagram of a device according to an embodiment of the present invention.
- FIG. 2 is a flowchart of a method according to an embodiment of the present invention.
- the device may include: an execution module on a web page, a local http service module, and a login information maintenance module.
- the execution module on the web page may be implemented in Javascript, and is responsible for sending a request for obtaining login session information to the local http service module when the web page is loaded.
- the login session information returned by the local http service module is used to implement login on the web page, and the login session information can be further stored in the cookie of the native app where the web page is located.
- the local http service module is built in a native app, and is responsible for receiving the request for obtaining the login session information sent by the execution module on the web page, determining the native app where the login session information is located, and sending the acquisition to the native app where the login session information is located.
- the login information maintenance module is built in the native app to maintain the login session information, and returns the login session information of the currently logged-in user to the local http service module at the request of the local http service module.
- the above login information maintenance module and the local http service module may be located in the same native app, or may be located in different native apps.
- the web page containing the execution module may be loaded in any native application capable of loading the web page, and the login information may be The native app where the maintenance module is located is loaded, or it can be loaded in the native app where the local http service module is located, or it can be loaded in any other native app.
- FIG. 2 shows the invention
- a method flow chart provided by the embodiment, as shown in FIG. 2, the method may include the following steps:
- the native app with the built-in local http service module initializes the local http service module to listen to the preset local network port after startup.
- This step is a pre-executed step.
- the local http service module can listen to a preset local network port and receive an http request sent to the local network port.
- the execution module on the web page sends an http request to obtain the login session information to the preset local network port.
- the http request may include application identification information (ie, identification information of the target application) where the login session information is located, and may also include JS callback function information.
- the application identification information of the login session information is set in advance in the execution module, and the native app of the webpage corresponding to the login session information of one service provider is also the other product of the same service provider, that is, the account adopts the same system domain name.
- the application identification information where the login session information is located may be set in advance in the execution module.
- the application identification information where the login session information is located may be preset as the identification information of the native app of the Baidu map, or the identification information of the native app known by Baidu, in the execution module on the web page of the Baidu map.
- the application identification information may include, but is not limited to, a package name or a package signature information of the application.
- the application identification information herein may be one or more than one application identification information.
- the execution module on the web page may first determine whether the corresponding login session information already exists in the cookie of the native app of the web page, and if it already exists, the cookie may be directly used. Log in to the session information to log in. If it does not exist, send a login session letter to the preset local network port. Http request.
- the local http service module listens to the http request from the preset local network port.
- the local http service module determines the validity of the http request, and if it is a legitimate request, continues to execute 205; if it is an illegal request, directly rejects the response or returns information indicating the error.
- the domain name range can be pre-configured in the local http service module, or the domain name range in the local http service module can be configured by sending configuration information in the cloud.
- the setting of the domain name range in this step is usually to limit the application scope of the login state synchronization method, and may not be limited, so this step is an optional step.
- the native app where the login session information acquired by the http request is located is determined (ie, the target application is determined).
- the native app corresponding to the application identifier information is directly determined. If the http request does not include the application identifier information of the login session information, the local http service module may determine the native app where the login session information is located according to the preset configuration information.
- the default configuration information here may be the default native app information, that is, if the http request does not include the application identification information, the local http service module uses the default native app as the native app where the login session information is located.
- the local http service module uses the default native app as the native app where the login session information is located.
- Baidu can set up Baidu mobile phone
- the assistant is the default native app. Once the target application is not specified in the received http request, the Baidu mobile assistant is used as the target application.
- the native app which is often logged in or has a high usage rate, can be configured as the default native app in the local http service module.
- the local http service module determines whether the native app determined in 205 has been installed locally by calling the system interface, and if so, executes 207; otherwise, returns information indicating the error.
- the local http service module sends a request to obtain login session information to the native app where the login session information is located.
- the local http service module sends a request for obtaining the login session information to the native app where the login session information is located by means of intra-process communication. If the native app where the local http service module is located and the native app where the login session information is located is a different app, the local http service module sends a request for obtaining the login session information to the native app where the login session information is located by means of inter-process communication.
- the way of inter-process communication can be, but is not limited to, the way of the pipeline, the way of sharing the memory, the way of the socket, and the like.
- the login information maintenance module of the native app in which the login session information is located returns the login session information of the currently logged-in user to the local http service module.
- the local http service module can send the request to the preset port of the native app where the login session information is located, and the login information maintenance module can receive the request through the preset port.
- the login information maintenance module may return information indicating the error.
- the returned login session information can be encrypted and returned in the form of an encrypted string.
- the local http service module generates login execution code using the login session information and the JS callback function information, and returns the login execution code to the execution module on the web page.
- the local http service module interacts with the execution module on the web page in the form of JSONP, web socket (socket), and the like.
- the execution module on the web page executes the received login execution code, completes the automatic login with the login session information, and stores the login session information in the cookie of the native app where the web page is located.
- the execution module on the web page automatically executes the code after receiving the login execution code.
- the process of executing the code is to complete the relevant processing logic for logging in on the web page by using the login session information, including obtaining account information, such as a user name, a password, etc. from the login session information, and inputting account information on the web page to request login.
- the login status information and the login session information may be stored in the cookie of the native app where the web page is located, and the login information is provided for the native app as the target application, and the same service is loaded in the native app next time.
- the provider's web page, that is, the account's system domain name is the same, the login session information in the cookie of the native app can be directly used to log in.
- the number of native apps in which the login session information determined in 205 is located may be multiple, and the local http service module may receive login session information returned by multiple native apps. If the account information in the plurality of login session information returned is the same, the execution code generated by one of the login session information is returned to the execution module on the web page. However, there is another possibility that the account information in the plurality of login session information returned is different. For example, if there are two Baidu accounts in the mobile phone that are respectively logged into the apps of two Baidu products, the local http service module can be utilized. Multiple login session information and JS callback function information generation login Execute the code.
- the login execution code in the process of being executed by the execution module on the web page, provides the account information in the plurality of login session information to the user for selection by the user, and automatically logs in according to the account information selected by the user.
- the local http service module may also adopt other methods, for example, selecting one of a plurality of login session information to generate a login execution code.
- the port sends an http request for obtaining login session information, where the http request includes JS callback function information and target application identification information, wherein the target application identification information may include a package name information of a native app of Baidu map, and a package name of a native app of Baidu Post Bar Information and package name information for the native app of Baidu Music.
- the local http service module can obtain the above http request by listening to the preset local network port. Assuming that the offer of the http request is legal, according to the target application identification information, a request for obtaining the login session information is sent to the native app of the locally installed Baidu map, the native app of Baidu music, and the session maintenance module in the native app of Baidu Post Bar. The method of sending inter-process communication to the native app of Baidu map and the native app of Baidu music is sent.
- Each session maintenance module determines whether the native app is in the login state. If the login state is in the login state, the execution execution code is returned to the local http service module by using the corresponding login session information and the JS callback function. The execution module is returned to the webpage of the Baidu map by the local http service module, and the execution module executes the above execution code to complete the automatic login. As long as one of the target applications is logged in, it is possible to return execution code to have the execution module on the web page automatically log in.
- the execution code can be generated using a plurality of login session information.
- the execution module on the web page in the process of executing the execution code, allows the user to select which account information to use for automatic login, and automatically log in according to the account information selected by the user.
- the disclosed apparatus and method may be implemented in other manners.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division, and the actual implementation may have another division manner.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
- the above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium.
- the above software functional unit is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform the methods of the various embodiments of the present invention. Part of the steps.
- the foregoing storage medium includes: a U disk, a mobile hard disk, and a read only memory. (Read-Only Memory, ROM), Random Access Memory (RAM), disk or optical disk, and other media that can store program code.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Information Transfer Between Computers (AREA)
- Computer And Data Communications (AREA)
Abstract
Description
本申请要求了申请日为2014年12月23日,申请号为201410815961.8发明名称为“一种同步登录状态的方法和装置”的中国专利申请的优先权。This application claims the priority of the Chinese patent application filed on Dec. 23, 2014, the filing date of
本发明涉及计算机应用技术领域,特别涉及一种同步登录状态的方法、装置、设备和计算机存储介质。The present invention relates to the field of computer application technologies, and in particular, to a method, an apparatus, a device, and a computer storage medium for synchronous login status.
目前大多数大型互联网服务提供商向智能终端既提供web app(网络应用)的服务,也提供native app(本地应用)的服务。其中web app是运行于网络和标准浏览器上,基于网页技术开发实现特定功能的应用,native app是基于智能终端的操作系统运行的应用。例如百度公司提供的贴吧、知道是web app的产品,百度手机卫士是native app的产品,很多产品是既存在web app也存在native app,例如百度地图、百度视频等既可以是web app的产品,也可以是native app的产品。At present, most large-scale Internet service providers provide both web app (web application) services and native app (local application) services to smart terminals. The web app is an application running on a network and a standard browser and developing a specific function based on webpage technology. The native app is an application running based on an operating system of the smart terminal. For example, Baidu company provides post bar, knows that it is a web app product, Baidu mobile guard is a native app product, many products are both web app and native app, such as Baidu map, Baidu video, etc. can be a web app product. It can also be a product of the native app.
基于上述特征,用户在使用同一服务提供商的不同产品时,通常使用同一账号,但需要分别在各产品上分别登录,这显然给用户操作带来了麻烦和不便,因此趋势是希望能够使得用户在使用同一服务提供商的不同产品时,能够自动同步登录状态到不同产品。Based on the above characteristics, when users use different products of the same service provider, they usually use the same account, but need to separately log in on each product, which obviously brings trouble and inconvenience to the user operation, so the trend is to make the user Automatically synchronize login status to different products when using different products from the same service provider.
目前已经实现的是在同一个native app中相同服务提供商的不同产品之间的登录状态同步,例如用户在百度手机浏览器中登录账户后,就可以将登录状态同步给所有在百度手机浏览器中打开的百度产品线的web页面。其实现方案是浏览器将用户的登录会话信息记录在针对该用户账户的系统域名所对应的用户cookie文件中,从而使得当该域名下的 web页面在该浏览器中被加载时,能够直接从cookie中获取登录会话信息,利用该登录会话信息进行自动登录。由于多数操作系统出于安全性考虑,都会为每个应用进程单独维护一份独立的cookie数据,不同应用进程的cookie数据是不能互通的,因此无法实现native app的登录状态同步至其他native app所加载的页面上。What has been achieved is the synchronization of login status between different products of the same service provider in the same native app. For example, after the user logs in to the account in Baidu mobile browser, the login status can be synchronized to all mobile browsers in Baidu. The web page of the Baidu product line opened in. The implementation scheme is that the browser records the login session information of the user in a user cookie file corresponding to the system domain name of the user account, so that when the domain name is When the web page is loaded in the browser, the login session information can be directly obtained from the cookie, and the login session information is used to automatically log in. Since most operating systems maintain a separate cookie data for each application process for security reasons, the cookie data of different application processes cannot be interoperable, so the login status of the native app cannot be synchronized to other native apps. Loaded on the page.
发明内容Summary of the invention
有鉴于此,本发明提供了一种同步登录状态的方法、装置、设备和计算机存储介质,以便于实现将native app的登录状态同步至其他native app所加载的页面上。In view of this, the present invention provides a method, apparatus, device and computer storage medium for synchronizing login status, in order to synchronize the login status of the native app to the page loaded by other native apps.
具体技术方案如下:The specific technical solutions are as follows:
一种同步登录状态的方法,该方法包括:A method for synchronizing login status, the method comprising:
web页面被加载时,该web页面上的执行模块向本地http服务模块发送获取登录会话信息的请求;When the web page is loaded, the execution module on the web page sends a request for obtaining login session information to the local http service module;
本地http服务模块接收到获取登录会话信息的请求后,确定登录会话信息所在的本地应用,从登录会话信息所在的本地应用获取当前登录用户的登录会话信息,将获取的登录会话信息返回给所述web页面上的执行模块;After receiving the request for obtaining the login session information, the local http service module determines the local application where the login session information is located, obtains the login session information of the currently logged-in user from the local application where the login session information is located, and returns the obtained login session information to the Execution module on the web page;
所述web页面上的执行模块利用所述登录会话信息进行自动登录。The execution module on the web page uses the login session information to perform automatic login.
根据本发明一优选实施方式,该方法还包括:所述本地http服务模块所在的本地应用启动后,初始化所述本地http服务模块以使所述本地http服务模块侦听预设的本地网络端口;According to a preferred embodiment of the present invention, the method further includes: after the local application of the local http service module is started, initializing the local http service module to enable the local http service module to listen to a preset local network port;
所述web页面上的执行模块向本地http服务模块发送获取登录会话信息的请求包括:所述web页面上的执行模块向所述预设的本地网络端 口发送所述获取登录会话信息的请求。Sending, by the execution module on the web page, the request for obtaining the login session information to the local http service module, the execution module on the web page to the preset local network end The port sends the request for obtaining login session information.
根据本发明一优选实施方式,所述确定登录会话信息所在的本地应用包括:According to a preferred embodiment of the present invention, the determining the local application where the login session information is located includes:
所述本地http服务模块依据所述获取登录会话信息的请求包含的应用标识信息,确定所述应用标识信息对应的本地应用。The local http service module determines the local application corresponding to the application identifier information according to the application identifier information included in the request for obtaining the login session information.
根据本发明一优选实施方式,所述确定登录会话信息所在的本地应用还包括:According to a preferred embodiment of the present invention, the determining that the local application where the login session information is located further includes:
如果所述获取登录会话信息的请求不包含所述应用标识信息,则所述本地http服务模块依据预设的配置信息,确定登录会话信息所在的本地应用。If the request for obtaining the login session information does not include the application identification information, the local http service module determines the local application where the login session information is located according to the preset configuration information.
根据本发明一优选实施方式,所述获取登录会话信息的请求包括JS回调函数信息;According to a preferred embodiment of the present invention, the request for acquiring login session information includes JS callback function information;
所述将获取的登录会话信息返回给所述web页面上的执行模块包括:利用获取的登录会话信息和所述JS回调函数信息生成执行代码,将所述执行代码返回给所述web页面上的执行模块;Returning the acquired login session information to the execution module on the webpage includes: generating an execution code by using the acquired login session information and the JS callback function information, and returning the execution code to the webpage Execution module
所述web页面上的执行模块利用所述登录会话信息进行自动登录包括:所述web页面上的执行模块执行所述执行代码以完成自动登录。Performing the automatic login by the execution module on the web page by using the login session information includes: executing the execution code on the web page to complete the automatic login.
根据本发明一优选实施方式,在所述确定登录会话信息所在的本地应用之前,还包括:According to a preferred embodiment of the present invention, before the determining the local application where the login session information is located, the method further includes:
本地http服务模块判断所述获取登录会话信息的请求的refer来源地址是否在预设的域名范围内,如果是,则继续执行所述确定登录会话信息所在的本地应用;否则,拒绝响应所述web页面上的执行模块或者向所述web页面上的执行模块返回指示错误的信息。 The local http service module determines whether the refer source address of the request for obtaining the login session information is within a preset domain name range, and if yes, continues to execute the local application where the login session information is determined; otherwise, rejects the response to the web The execution module on the page returns information indicating an error to the execution module on the web page.
根据本发明一优选实施方式,在所述从登录会话信息所在的本地应用获取当前登录用户的登录会话信息之前还包括:According to a preferred embodiment of the present invention, before the obtaining the login session information of the currently logged in user from the local application where the login session information is located, the method further includes:
所述本地http服务模块通过调用系统接口判断登录会话信息所在的本地应用是否已经安装在本地,如果是,继续执行所述从登录会话信息所在的本地应用获取当前登录用户的登录会话信息;否则,向所述web页面上的执行模块返回指示错误的信息。The local http service module determines whether the local application where the login session information is located is locally installed by calling the system interface, and if yes, continuing to execute the login application information of the current login user from the local application where the login session information is located; otherwise, Information indicating an error is returned to the execution module on the web page.
根据本发明一优选实施方式,所述从登录会话信息所在的本地应用获取当前登录用户的登录会话信息包括:According to a preferred embodiment of the present invention, the obtaining the login session information of the currently logged-in user from the local application where the login session information is located includes:
如果所述本地http服务模块所在的本地应用与所述登录会话信息所在的本地应用是同一个应用,则所述本地http服务模块通过进程内通信的方式向位于同一本地应用的会话信息维护模块发送请求,并获取该会话信息维护模块返回的当前登录用户的登录会话信息;或者,If the local application of the local http service module is the same application as the local application where the login session information is located, the local http service module sends the session information maintenance module located in the same local application by means of intra-process communication. Requesting, and obtaining login session information of the currently logged-in user returned by the session information maintenance module; or
如果所述本地http服务模块所在的本地应用与所述登录会话信息所在的本地应用是不同的应用,则所述本地http服务模块通过进程间通信的方式向所述登录会话信息所在的本地应用中的会话信息维护模块发送请求,并获取该会话信息维护模块返回的当前登录用户的登录会话信息。If the local application of the local http service module is different from the local application where the login session information is located, the local http service module sends the local application in the local application where the login session information is located by means of inter-process communication. The session information maintenance module sends a request, and obtains login session information of the currently logged-in user returned by the session information maintenance module.
根据本发明一优选实施方式,该方法还包括:According to a preferred embodiment of the present invention, the method further includes:
所述web页面上的执行模块自动登录后,将登录状态信息和登录会话信息存储于web页面所在的本地应用的cookie中。After the execution module on the web page automatically logs in, the login status information and the login session information are stored in a cookie of the local application where the web page is located.
根据本发明一优选实施方式,所述web页面上的执行模块向本地http服务模块发送获取登录会话信息的请求之前,还包括:According to a preferred embodiment of the present invention, before the execution module on the web page sends a request for obtaining the login session information to the local http service module, the method further includes:
判断所述web页面所在本地应用的cookie中是否存在对应的登录会话信息,如果是,使用所述web页面所在的本地应用的cookie中对应的 登录会话信息进行登录;否则执行所述向本地http服务模块发送获取登录会话信息的请求。Determining whether there is corresponding login session information in the cookie of the local application where the web page is located, and if so, using a corresponding cookie in the local application where the web page is located Log in to the session information to log in; otherwise, execute the request to send the login session information to the local http service module.
本发明还提供了一种同步登录状态的装置,该装置包括:The present invention also provides an apparatus for synchronous login status, the apparatus comprising:
web页面上的执行模块,用于当web页面被加载时,向本地http服务模块发送获取登录会话信息的请求;利用本地http服务模块返回的登录会话信息进行自动登录;An execution module on the web page, configured to send a request for obtaining login session information to the local http service module when the web page is loaded; and automatically log in using the login session information returned by the local http service module;
本地http服务模块,用于接收到获取登录会话信息的请求后,确定登录会话信息所在的本地应用,从登录会话信息所在的本地应用获取当前登录用户的登录会话信息,将获取的登录会话信息返回给所述web页面上的执行模块。The local http service module is configured to: after receiving the request for obtaining the login session information, determine the local application where the login session information is located, obtain the login session information of the currently logged-in user from the local application where the login session information is located, and return the obtained login session information. Give the execution module on the web page.
根据本发明一优选实施方式,所述本地http服务模块,用于被所在的本地应用初始化后,侦听预设的本地网络端口;According to a preferred embodiment of the present invention, the local http service module is configured to listen to a preset local network port after being initialized by the local application;
所述web页面上的执行模块,具体用于向所述预设的本地网络端口发送所述获取登录会话信息的请求。The execution module on the webpage is specifically configured to send the request for acquiring login session information to the preset local network port.
根据本发明一优选实施方式,所述本地http服务模块在确定登录会话信息所在的本地应用时,具体用于依据所述获取登录会话信息的请求包含的应用标识信息,确定所述应用标识信息对应的本地应用。According to a preferred embodiment of the present invention, the local http service module, when determining the local application where the login session information is located, is specifically configured to determine, according to the application identification information included in the request for obtaining the login session information, that the application identification information is corresponding. Local application.
根据本发明一优选实施方式,所述本地http服务模块,还用于如果所述获取登录会话信息的请求不包含所述应用标识信息,则依据预设的配置信息,确定登录会话信息所在的本地应用。According to a preferred embodiment of the present invention, the local http service module is further configured to: if the request for acquiring the login session information does not include the application identification information, determine, according to the preset configuration information, the local location where the login session information is located. application.
根据本发明一优选实施方式,所述本地http服务模块在将获取的登录会话信息返回给所述web页面上的执行模块时,具体执行:利用获取的登录会话信息和所述获取登录会话信息的请求中包含的JS回调函数 信息生成执行代码,将所述执行代码返回给所述web页面上的执行模块;According to a preferred embodiment of the present invention, when the local http service module returns the obtained login session information to the execution module on the web page, the specific execution is performed by using the acquired login session information and the obtaining login session information. JS callback function included in the request The information generation execution code returns the execution code to an execution module on the web page;
所述web页面上的执行模块,具体用于执行所述执行代码以完成自动登录。The execution module on the web page is specifically configured to execute the execution code to complete automatic login.
根据本发明一优选实施方式,本地http服务模块,还用于在确定登录会话信息所在的本地应用之前,判断所述获取登录会话信息的请求的refer来源地址是否在预设的域名范围内,如果是,则继续执行所述确定登录会话信息所在的本地应用;否则,拒绝响应所述web页面上的执行模块或者向所述web页面上的执行模块返回指示错误的信息。According to a preferred embodiment of the present invention, the local http service module is further configured to determine, before determining the local application where the login session information is located, whether the refer source address of the request for obtaining the login session information is within a preset domain name range, if If yes, proceed to execute the local application where the login session information is determined; otherwise, refuse to respond to the execution module on the web page or return information indicating an error to the execution module on the web page.
根据本发明一优选实施方式,所述本地http服务模块在从登录会话信息所在的本地应用获取当前登录用户的登录会话信息之前还用于,通过调用系统接口判断登录会话信息所在的本地应用是否已经安装在本地,如果是,继续执行所述从登录会话信息所在的本地应用获取当前登录用户的登录会话信息;否则,向所述web页面上的执行模块返回指示错误的信息。According to a preferred embodiment of the present invention, the local http service module is further configured to determine, by calling the system interface, whether the local application where the login session information is located before the login session information of the currently logged in user is obtained from the local application where the login session information is located. Installed locally, if yes, continue to execute the login session information of the current login user from the local application where the login session information is located; otherwise, return information indicating the error to the execution module on the web page.
根据本发明一优选实施方式,该装置还包括会话信息维护模块;According to a preferred embodiment of the present invention, the apparatus further includes a session information maintenance module;
所述本地http服务模块在从登录会话信息所在的本地应用获取当前登录用户的登录会话信息时,具体执行:如果所述本地http服务模块所在的本地应用与所述登录会话信息所在的本地应用是同一个应用,则通过进程内通信的方式向位于同一本地应用的会话信息维护模块发送请求,并获取该会话信息维护模块返回的当前登录用户的登录会话信息;或者,如果所述本地http服务模块所在的本地应用与所述登录会话信息所在的本地应用是不同的应用,则通过进程间通信的方式向所述登录会话信息所在的本地应用中的会话信息维护模块发送请求,并获取该会话信息维 护模块返回的当前登录用户的登录会话信息;When the local http service module obtains the login session information of the currently logged in user from the local application where the login session information is located, the local application is: if the local application where the local http service module is located and the local application where the login session information is located is The same application sends a request to the session information maintenance module of the same local application by means of intra-process communication, and obtains login session information of the currently logged-in user returned by the session information maintenance module; or, if the local http service module The local application that is located is different from the local application where the login session information is located, and sends a request to the session information maintenance module in the local application where the login session information is located, and obtains the session information by means of inter-process communication. Wei The login session information of the currently logged in user returned by the protection module;
所述会话信息维护模块,用于接收到所述本地http服务模块发送的请求后,向所述本地http服务模块返回该会话信息维护模块所在本地应用中当前登录用户的登录会话信息。The session information maintenance module is configured to: after receiving the request sent by the local http service module, return the login session information of the currently logged-in user in the local application where the session information maintenance module is located to the local http service module.
根据本发明一优选实施方式,所述web页面上的执行模块,还用于在自动登录后,将登录状态信息和登录会话信息存储于web页面所在的本地应用的cookie中。According to a preferred embodiment of the present invention, the execution module on the web page is further configured to store the login status information and the login session information in a cookie of the local application where the web page is located after the automatic login.
根据本发明一优选实施方式,所述web页面上的执行模块,还用于在向本地http服务模块发送获取登录会话信息的请求之前,判断所述web页面所在本地应用的cookie中是否存在对应的登录会话信息,如果是,使用所述web页面所在的本地应用的cookie中对应的登录会话信息进行登录;否则执行所述向本地http服务模块发送获取登录会话信息的请求。According to a preferred embodiment of the present invention, the execution module on the web page is further configured to: before sending a request for obtaining login session information to the local http service module, determining whether a cookie exists in a local application cookie of the web page. Log in to the session information, if yes, log in using the corresponding login session information in the cookie of the local application where the web page is located; otherwise, execute the request to send the login session information to the local http service module.
由以上技术方案可以看出,本发明能够将native app的登录状态同步至其他native应用所加载的页面上,只要智能终端中存在native app处于登录状态,那么当用户在智能终端中打开与该native app属于同一账户系统域名的web页面都能够实现自动登录,减少用户操作,提升用户体验。It can be seen from the above technical solution that the present invention can synchronize the login status of the native app to the page loaded by other native applications, as long as the native app is in the login state in the smart terminal, then when the user opens in the smart terminal and the native The web pages of the app belonging to the same account system domain name can be automatically logged in, reducing user operations and improving the user experience.
图1为本发明实施例提供的装置结构图;1 is a structural diagram of a device according to an embodiment of the present invention;
图2为本发明实施例提供的方法流程图。FIG. 2 is a flowchart of a method according to an embodiment of the present invention.
为了使本发明的目的、技术方案和优点更加清楚,下面结合附图和 具体实施例对本发明进行详细描述。In order to make the objects, technical solutions and advantages of the present invention more clear, the following DETAILED DESCRIPTION OF THE INVENTION The present invention is described in detail.
为了方便理解首先对本发明提供的装置结构进行介绍,如图1中所示,该装置可以包括:web页面上的执行模块、本地http服务模块以及登录信息维护模块。For convenience of understanding, the device structure provided by the present invention is first introduced. As shown in FIG. 1, the device may include: an execution module on a web page, a local http service module, and a login information maintenance module.
其中web页面上的执行模块可以采用Javascript实现,负责在web页面被加载时,向本地http服务模块发送获取登录会话信息的请求。利用本地http服务模块返回的登录会话信息实现在web页面上的登录,并可以进一步将登录会话信息存储于该web页面所在native app的cookie中。The execution module on the web page may be implemented in Javascript, and is responsible for sending a request for obtaining login session information to the local http service module when the web page is loaded. The login session information returned by the local http service module is used to implement login on the web page, and the login session information can be further stored in the cookie of the native app where the web page is located.
本地http服务模块内置于某一个native app中,负责接收web页面上的执行模块发送的获取登录会话信息的请求,确定该登录会话信息所在的native app,并向登录会话信息所在的native app发送获取登录会话信息的请求;获取登录会话信息所在的native app返回的登录会话信息,并将获取的登录会话信息返回给web页面上的执行模块。The local http service module is built in a native app, and is responsible for receiving the request for obtaining the login session information sent by the execution module on the web page, determining the native app where the login session information is located, and sending the acquisition to the native app where the login session information is located. The request for logging in to the session information; obtaining the login session information returned by the native app where the login session information is located, and returning the obtained login session information to the execution module on the web page.
登录信息维护模块内置于native app中用于维护登录会话信息,并应本地http服务模块的请求向本地http服务模块返回当前登录用户的登录会话信息。The login information maintenance module is built in the native app to maintain the login session information, and returns the login session information of the currently logged-in user to the local http service module at the request of the local http service module.
上述登录信息维护模块与本地http服务模块可以位于同一个native app,也可以位于不同native app,上述含执行模块的web页面可以在任何能够加载web页面的native应用内被加载,可以在上述登录信息维护模块所在的native app被加载,也可以在上述本地http服务模块所在的native app被加载,也可以在其他任意native app中被加载。The above login information maintenance module and the local http service module may be located in the same native app, or may be located in different native apps. The web page containing the execution module may be loaded in any native application capable of loading the web page, and the login information may be The native app where the maintenance module is located is loaded, or it can be loaded in the native app where the local http service module is located, or it can be loaded in any other native app.
下面结合图2对本发明提供的方法进行详细描述。图2为本发明实 施例提供的方法流程图,如图2中所示,该方法可以包括以下步骤:The method provided by the present invention will be described in detail below with reference to FIG. Figure 2 shows the invention A method flow chart provided by the embodiment, as shown in FIG. 2, the method may include the following steps:
在201中,内置有本地http服务模块的native app在启动后,初始化本地http服务模块以侦听预设的本地网络端口。In 201, the native app with the built-in local http service module initializes the local http service module to listen to the preset local network port after startup.
本步骤是预先执行的步骤,初始化本地http服务模块后,本地http服务模块就能够对预设的一个本地网络端口进行侦听,接收发送至该本地网络端口的http请求。This step is a pre-executed step. After the local http service module is initialized, the local http service module can listen to a preset local network port and receive an http request sent to the local network port.
在202中,当有某个native app(例如手机浏览器)加载web页面时,web页面上的执行模块向预设的本地网络端口发送获取登录会话信息的http请求。该http请求可以包含登录会话信息所在的应用标识信息(即目标应用的标识信息),还可以包含JS回调函数信息。In 202, when a native app (eg, a mobile browser) loads the web page, the execution module on the web page sends an http request to obtain the login session information to the preset local network port. The http request may include application identification information (ie, identification information of the target application) where the login session information is located, and may also include JS callback function information.
其中登录会话信息所在的应用标识信息是预先在执行模块中设置好的,一个服务提供商的web页面对应登录会话信息所在的native app也是同一服务提供商的其他产品,即账户采用相同的系统域名,在此可以预先在执行模块中设置登录会话信息所在的应用标识信息。例如,可以在百度地图的web页面上的执行模块中预先设置登录会话信息所在的应用标识信息为百度地图的native app的标识信息,或者百度知道的native app的标识信息等。该应用标识信息可以包括但不限于应用的包名或包签名信息,另外,这里的应用标识信息可以是一个,也可以是多于一个的应用标识信息。The application identification information of the login session information is set in advance in the execution module, and the native app of the webpage corresponding to the login session information of one service provider is also the other product of the same service provider, that is, the account adopts the same system domain name. Here, the application identification information where the login session information is located may be set in advance in the execution module. For example, the application identification information where the login session information is located may be preset as the identification information of the native app of the Baidu map, or the identification information of the native app known by Baidu, in the execution module on the web page of the Baidu map. The application identification information may include, but is not limited to, a package name or a package signature information of the application. In addition, the application identification information herein may be one or more than one application identification information.
另外,在本步骤中,加载web页面后,web页面上的执行模块可以首先判断该web页面所在native app的cookie中是否已经存在对应的登录会话信息,如果已经存在,则可以直接利用cookie中的登录会话信息进行登录。如果不存在,再向预设的本地网络端口发送获取登录会话信 息的http请求。In addition, in this step, after loading the web page, the execution module on the web page may first determine whether the corresponding login session information already exists in the cookie of the native app of the web page, and if it already exists, the cookie may be directly used. Log in to the session information to log in. If it does not exist, send a login session letter to the preset local network port. Http request.
在203中,本地http服务模块从预设的本地网络端口侦听到上述http请求。In 203, the local http service module listens to the http request from the preset local network port.
在204中,本地http服务模块判断http请求的合法性,如果是合法请求,继续执行205;如果是非法请求,则直接拒绝响应或者返回指示错误的信息。In 204, the local http service module determines the validity of the http request, and if it is a legitimate request, continues to execute 205; if it is an illegal request, directly rejects the response or returns information indicating the error.
本步骤中可以校验http请求的refer(来源地址)是否在预设的域名范围内来判断http请求的合法性,如果http请求的refer不再预设的域名范围内,则确定该http请求非法,如果在预设的域名范围内,则确定该http请求合法。上述域名范围可以预先设置于本地http服务模块中,也可以通过云端下发配置信息的方式对本地http服务模块中的域名范围进行配置。In this step, it is possible to check whether the refer (http) of the http request is within the preset domain name to determine the validity of the http request. If the referential of the http request is no longer within the preset domain name, it is determined that the http request is illegal. If it is within the preset domain name, it is determined that the http request is legal. The domain name range can be pre-configured in the local http service module, or the domain name range in the local http service module can be configured by sending configuration information in the cloud.
本步骤中域名范围的设置通常是为了限制登录状态同步这一方法的应用范围,也可以不进行限制,因此本步骤是一个可选步骤。The setting of the domain name range in this step is usually to limit the application scope of the login state synchronization method, and may not be limited, so this step is an optional step.
在205中,确定该http请求获取的登录会话信息所在的native app(即确定目标应用)。In 205, the native app where the login session information acquired by the http request is located is determined (ie, the target application is determined).
如果http请求中包含登录会话信息所在的应用标识信息,则直接确定该应用标识信息对应的native app。如果http请求中不包含登录会话信息所在的应用标识信息,则本地http服务模块可以根据预设的配置信息确定登录会话信息所在的native app。If the http request includes the application identifier information of the login session information, the native app corresponding to the application identifier information is directly determined. If the http request does not include the application identifier information of the login session information, the local http service module may determine the native app where the login session information is located according to the preset configuration information.
这里预设的配置信息可以是默认的native app信息,即如果http请求中不包含应用标识信息,本地http服务模块就采用默认的native app作为登录会话信息所在的native app。例如,百度公司可以设置百度手机 助手作为默认native app,一旦接收到的http请求中没有指定目标应用,则将百度手机助手作为目标应用。可以将经常处于登录状态,或者使用率较高的native app作为默认的native app配置于本地http服务模块中。The default configuration information here may be the default native app information, that is, if the http request does not include the application identification information, the local http service module uses the default native app as the native app where the login session information is located. For example, Baidu can set up Baidu mobile phone The assistant is the default native app. Once the target application is not specified in the received http request, the Baidu mobile assistant is used as the target application. The native app, which is often logged in or has a high usage rate, can be configured as the default native app in the local http service module.
在206中,本地http服务模块通过调用系统接口判断在205中确定的native app是否已经安装在本地,如果是,执行207;否则,返回指示错误的信息。In 206, the local http service module determines whether the native app determined in 205 has been installed locally by calling the system interface, and if so, executes 207; otherwise, returns information indicating the error.
在207中,本地http服务模块向登录会话信息所在的native app发送获取登录会话信息的请求。In 207, the local http service module sends a request to obtain login session information to the native app where the login session information is located.
如果本地http服务模块所在的native app与登录会话信息所在的native app是同一个app,则本地http服务模块采用进程内通信的方式发送获取登录会话信息的请求给登录会话信息所在的native app。如果本地http服务模块所在的native app与登录会话信息所在的native app是不同的app,则本地http服务模块采用进程间通信的方式发送获取登录会话信息的请求给登录会话信息所在的native app。进程间通信的方式可以采用但不限于管道的方式、共享内存的方式、套接字的方式等。If the native app of the local http service module is the same app as the native app where the login session information is located, the local http service module sends a request for obtaining the login session information to the native app where the login session information is located by means of intra-process communication. If the native app where the local http service module is located and the native app where the login session information is located is a different app, the local http service module sends a request for obtaining the login session information to the native app where the login session information is located by means of inter-process communication. The way of inter-process communication can be, but is not limited to, the way of the pipeline, the way of sharing the memory, the way of the socket, and the like.
在208中,登录会话信息所在的native app中登录信息维护模块接收到获取登录会话信息的请求后,将当前登录用户的登录会话信息返回给本地http服务模块。In 208, after receiving the request for obtaining the login session information, the login information maintenance module of the native app in which the login session information is located returns the login session information of the currently logged-in user to the local http service module.
本地http服务模块可以将请求发送至登录会话信息所在的native app的预设端口,登录信息维护模块通过该预设端口就能够接收到该请求。The local http service module can send the request to the preset port of the native app where the login session information is located, and the login information maintenance module can receive the request through the preset port.
如果登录信息维护模块确定当前处于未登录状态,则可以返回指示错误的信息。另外,为了保证安全,返回的登录会话信息可以进行加密并以加密串的形态返回。 If the login information maintenance module determines that it is currently in the unlogged state, it may return information indicating the error. In addition, in order to ensure security, the returned login session information can be encrypted and returned in the form of an encrypted string.
在209中,本地http服务模块利用登录会话信息和JS回调函数信息生成登录执行代码,将登录执行代码返回给web页面上的执行模块。In 209, the local http service module generates login execution code using the login session information and the JS callback function information, and returns the login execution code to the execution module on the web page.
本地http服务模块与web页面上的执行模块采用JSONP、web socket(套接字)等形式进行http交互。The local http service module interacts with the execution module on the web page in the form of JSONP, web socket (socket), and the like.
在210中,web页面上的执行模块执行接收到的登录执行代码,完成利用登录会话信息自动登录,并将登录会话信息存储于该web页面所在native app的cookie中。In 210, the execution module on the web page executes the received login execution code, completes the automatic login with the login session information, and stores the login session information in the cookie of the native app where the web page is located.
web页面上的执行模块接收到登录执行代码后,自动执行该代码。执行代码的过程就是利用登录会话信息完成在web页面上登录的相关处理逻辑,包括从登录会话信息中获取账户信息,例如用户名、密码等,在web页面上输入账户信息以请求登录。The execution module on the web page automatically executes the code after receiving the login execution code. The process of executing the code is to complete the relevant processing logic for logging in on the web page by using the login session information, including obtaining account information, such as a user name, a password, etc. from the login session information, and inputting account information on the web page to request login.
在自动登录后,登录状态信息和登录会话信息可以存储于web页面所在native app的cookie中,供该native app作为目标应用时提供登录会话信息使用,也供下次在该native app中加载同一服务提供商的web页面时,即账户的系统域名相同时,能够直接使用该native app的cookie中的登录会话信息进行登录。After the automatic login, the login status information and the login session information may be stored in the cookie of the native app where the web page is located, and the login information is provided for the native app as the target application, and the same service is loaded in the native app next time. When the provider's web page, that is, the account's system domain name is the same, the login session information in the cookie of the native app can be directly used to log in.
另外,在205中确定出的登录会话信息所在的native app可能是多个,那么本地http服务模块就可能收到多个native app返回的登录会话信息。如果返回的多个登录会话信息中账户信息是相同的,则利用其中一个登录会话信息生成执行代码返回给web页面上的执行模块即可。但也存在另外的可能性,即返回的多个登录会话信息中账户信息是不同的,例如在手机中可能有两个百度账户分别登录了两个百度产品的app,那么本地http服务模块可以利用多个登录会话信息和JS回调函数信息生成登录 执行代码。该登录执行代码在被web页面上的执行模块执行的过程中,会将多个登录会话信息中的账户信息提供给用户供用户选择,并依据用户选择的账户信息进行自动登录。当然,本地http服务模块也可以采用其他方式,例如从多个登录会话信息中选择一个用以生成登录执行代码。In addition, the number of native apps in which the login session information determined in 205 is located may be multiple, and the local http service module may receive login session information returned by multiple native apps. If the account information in the plurality of login session information returned is the same, the execution code generated by one of the login session information is returned to the execution module on the web page. However, there is another possibility that the account information in the plurality of login session information returned is different. For example, if there are two Baidu accounts in the mobile phone that are respectively logged into the apps of two Baidu products, the local http service module can be utilized. Multiple login session information and JS callback function information generation login Execute the code. The login execution code, in the process of being executed by the execution module on the web page, provides the account information in the plurality of login session information to the user for selection by the user, and automatically logs in according to the account information selected by the user. Of course, the local http service module may also adopt other methods, for example, selecting one of a plurality of login session information to generate a login execution code.
下面举一个实例,用户在浏览器上打开百度地图的web页面时,如果浏览器本地的cookie没有百度地图的账户域名对应的登录会话信息,则该web页面上的执行模块向预设的本地网络端口发送获取登录会话信息的http请求,该http请求中包含JS回调函数信息和目标应用标识信息,其中目标应用标识信息可以包括百度地图的native app的包名信息、百度贴吧的native app的包名信息以及百度音乐的native app的包名信息。The following is an example. When a user opens a web page of Baidu map on a browser, if the browser local cookie does not have the login session information corresponding to the account domain name of the Baidu map, the execution module on the web page is to the preset local network. The port sends an http request for obtaining login session information, where the http request includes JS callback function information and target application identification information, wherein the target application identification information may include a package name information of a native app of Baidu map, and a package name of a native app of Baidu Post Bar Information and package name information for the native app of Baidu Music.
假设本地http服务模块内置于百度贴吧的native app中,那么本地http服务模块通过侦听预设的本地网络端口能够获取到上述http请求。假设该http请求的offer合法,依据其中的目标应用标识信息,向本地安装的百度地图的native app、百度音乐的native app以及百度贴吧的native app中的会话维护模块发送获取登录会话信息的请求。其中向百度地图的native app和百度音乐的native app发送请求采用进程间通信的方式。Assuming that the local http service module is built into the native app of Baidu Post Bar, the local http service module can obtain the above http request by listening to the preset local network port. Assuming that the offer of the http request is legal, according to the target application identification information, a request for obtaining the login session information is sent to the native app of the locally installed Baidu map, the native app of Baidu music, and the session maintenance module in the native app of Baidu Post Bar. The method of sending inter-process communication to the native app of Baidu map and the native app of Baidu music is sent.
各会话维护模块分别判断本native app是否处于登录状态,如果处于登录状态,则利用对应的登录会话信息和JS回调函数生成执行代码返回给本地http服务模块。由本地http服务模块返回给百度地图的web页面上的执行模块,该执行模块执行上述执行代码,完成自动登录。只要有一个目标应用处于登录状态,就能够返回执行代码让web页面上的执行模块自动登录。Each session maintenance module determines whether the native app is in the login state. If the login state is in the login state, the execution execution code is returned to the local http service module by using the corresponding login session information and the JS callback function. The execution module is returned to the webpage of the Baidu map by the local http service module, and the execution module executes the above execution code to complete the automatic login. As long as one of the target applications is logged in, it is possible to return execution code to have the execution module on the web page automatically log in.
在此,如果本地http服务模块接收到多个登录会话信息,且登录会 话信息中的账户信息不同,则可以利用多个登录会话信息生成执行代码。web页面上的执行模块在执行该执行代码的过程中,会让用户选择采用哪个账户信息进行自动登录,并根据用户选择的账户信息进行自动登录。Here, if the local http service module receives multiple login session information, and the login will If the account information in the message information is different, the execution code can be generated using a plurality of login session information. The execution module on the web page, in the process of executing the execution code, allows the user to select which account information to use for automatic login, and automatically log in according to the account information selected by the user.
可见,只要用户在智能终端中使用了服务提供商的一个native app进行登录,那么在其他native app中打开同一服务提供上的web页面都能够进行自动登录。It can be seen that as long as the user uses a native app of the service provider to log in in the smart terminal, the web page on the same service provider can be automatically logged in in other native apps.
在本发明所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division, and the actual implementation may have another division manner.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
上述以软件功能单元的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能单元存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本发明各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器 (Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium. The above software functional unit is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform the methods of the various embodiments of the present invention. Part of the steps. The foregoing storage medium includes: a U disk, a mobile hard disk, and a read only memory. (Read-Only Memory, ROM), Random Access Memory (RAM), disk or optical disk, and other media that can store program code.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明保护的范围之内。 The above are only the preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalents, improvements, etc., which are made within the spirit and principles of the present invention, should be included in the present invention. Within the scope of protection.
Claims (22)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410815961.8 | 2014-12-23 | ||
| CN201410815961.8A CN104580406B (en) | 2014-12-23 | 2014-12-23 | A kind of method and apparatus of synchronous logging state |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2016101635A1 true WO2016101635A1 (en) | 2016-06-30 |
Family
ID=53095564
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2015/087219 Ceased WO2016101635A1 (en) | 2014-12-23 | 2015-08-17 | Method, apparatus and device for synchronizing login status, and computer storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN104580406B (en) |
| WO (1) | WO2016101635A1 (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109547237A (en) * | 2018-11-02 | 2019-03-29 | 航天信息股份有限公司 | A kind of monitoring system and method for web application |
| CN112069476A (en) * | 2020-09-16 | 2020-12-11 | 杭州安恒信息技术股份有限公司 | A login state detection method, device, device and readable storage medium |
| CN114721836A (en) * | 2021-01-05 | 2022-07-08 | 武汉斗鱼网络科技有限公司 | Method, device and equipment for synchronizing login states and storage medium |
| CN114827158A (en) * | 2021-01-18 | 2022-07-29 | 网宿科技股份有限公司 | Configuration information loading method, system and server |
Families Citing this family (13)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104580406B (en) * | 2014-12-23 | 2019-11-26 | 北京百度网讯科技有限公司 | A kind of method and apparatus of synchronous logging state |
| CN106572068A (en) * | 2015-10-13 | 2017-04-19 | 阿里巴巴集团控股有限公司 | Account synchronous login method and device |
| CN105610938B (en) * | 2015-12-24 | 2019-02-15 | 广州爱九游信息技术有限公司 | Login state synchronization method and system |
| CN105791324B (en) * | 2016-05-12 | 2019-12-06 | 腾讯科技(深圳)有限公司 | Account login method and device |
| CN107995245B (en) * | 2016-10-27 | 2019-03-15 | 腾讯科技(深圳)有限公司 | A kind of method and terminal of resource-sharing |
| CN106790269B (en) * | 2017-02-15 | 2020-09-29 | 东软集团股份有限公司 | Recovery method and device for overtime login of application program |
| CN110650129B (en) * | 2017-09-20 | 2022-02-18 | 青岛海信移动通信技术股份有限公司 | Account login method and device and computer readable storage medium |
| US10812465B2 (en) | 2017-09-20 | 2020-10-20 | Hisense Mobile Communications Technology Co., Ltd. | Method for logging into account on mobile device, mobile device, and non-transitory computer readable storage medium |
| CN109040072B (en) * | 2018-08-06 | 2021-03-12 | 武汉斗鱼网络科技有限公司 | A method, system, server and storage medium for client authorization to log in to webpage |
| CN109375960B (en) * | 2018-09-29 | 2021-10-01 | 郑州云海信息技术有限公司 | A method and device for loading copyright information |
| CN111353142A (en) * | 2019-02-15 | 2020-06-30 | 鸿合科技股份有限公司 | User information sharing method and device and electronic equipment |
| CN109981781B (en) * | 2019-03-27 | 2021-08-06 | 深圳市网心科技有限公司 | Data processing method and system, electronic device and storage medium |
| CN110224924B (en) * | 2019-05-21 | 2021-04-09 | 腾讯科技(深圳)有限公司 | State updating method and device, storage medium and electronic device |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101369272A (en) * | 2007-08-17 | 2009-02-18 | 徐萍 | Auto-filling system and method for auto-filling registration or login information |
| CN102065141A (en) * | 2010-12-27 | 2011-05-18 | 广州欢网科技有限责任公司 | Method and system for realizing single sign-on of cross-application and browser |
| US20120324556A1 (en) * | 2011-06-17 | 2012-12-20 | Ebay Inc. | Passporting credentials between a mobile app and a web browser |
| CN104519050A (en) * | 2014-11-14 | 2015-04-15 | 百度在线网络技术(北京)有限公司 | Login method and login system |
| CN104580406A (en) * | 2014-12-23 | 2015-04-29 | 北京百度网讯科技有限公司 | Method and device for synchronizing login status |
| CN104735066A (en) * | 2015-03-18 | 2015-06-24 | 百度在线网络技术(北京)有限公司 | Single sign-on method, device and system oriented to web page applications |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101504616B (en) * | 2009-03-23 | 2011-08-10 | 金蝶软件(中国)有限公司 | Method and apparatus for login of Windows application program through Web application |
| CN102882903B (en) * | 2011-07-12 | 2017-07-28 | 腾讯科技(深圳)有限公司 | A kind of many website application message acquisition methods and system |
| CN102495855B (en) * | 2011-11-21 | 2013-09-25 | 奇智软件(北京)有限公司 | Automatic login method and device |
| CN102638454B (en) * | 2012-03-14 | 2014-05-21 | 武汉理工大学 | A plug-in single sign-on integration method for HTTP authentication protocol |
| CN102984218B (en) * | 2012-11-12 | 2016-08-24 | 北京奇虎科技有限公司 | Browser and login method thereof and system |
-
2014
- 2014-12-23 CN CN201410815961.8A patent/CN104580406B/en active Active
-
2015
- 2015-08-17 WO PCT/CN2015/087219 patent/WO2016101635A1/en not_active Ceased
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101369272A (en) * | 2007-08-17 | 2009-02-18 | 徐萍 | Auto-filling system and method for auto-filling registration or login information |
| CN102065141A (en) * | 2010-12-27 | 2011-05-18 | 广州欢网科技有限责任公司 | Method and system for realizing single sign-on of cross-application and browser |
| US20120324556A1 (en) * | 2011-06-17 | 2012-12-20 | Ebay Inc. | Passporting credentials between a mobile app and a web browser |
| CN104519050A (en) * | 2014-11-14 | 2015-04-15 | 百度在线网络技术(北京)有限公司 | Login method and login system |
| CN104580406A (en) * | 2014-12-23 | 2015-04-29 | 北京百度网讯科技有限公司 | Method and device for synchronizing login status |
| CN104735066A (en) * | 2015-03-18 | 2015-06-24 | 百度在线网络技术(北京)有限公司 | Single sign-on method, device and system oriented to web page applications |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109547237A (en) * | 2018-11-02 | 2019-03-29 | 航天信息股份有限公司 | A kind of monitoring system and method for web application |
| CN112069476A (en) * | 2020-09-16 | 2020-12-11 | 杭州安恒信息技术股份有限公司 | A login state detection method, device, device and readable storage medium |
| CN112069476B (en) * | 2020-09-16 | 2022-07-12 | 杭州安恒信息技术股份有限公司 | Login state detection method, device, equipment and readable storage medium |
| CN114721836A (en) * | 2021-01-05 | 2022-07-08 | 武汉斗鱼网络科技有限公司 | Method, device and equipment for synchronizing login states and storage medium |
| CN114827158A (en) * | 2021-01-18 | 2022-07-29 | 网宿科技股份有限公司 | Configuration information loading method, system and server |
Also Published As
| Publication number | Publication date |
|---|---|
| CN104580406A (en) | 2015-04-29 |
| CN104580406B (en) | 2019-11-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN104580406B (en) | A kind of method and apparatus of synchronous logging state | |
| US9954855B2 (en) | Login method and apparatus, and open platform system | |
| US10567841B2 (en) | Information interception processing method, terminal, and computer storage medium | |
| CN102682080B (en) | Cookie information sharing method and system | |
| US20170279794A1 (en) | User information obtaining method and apparatus, and server | |
| US20150288673A1 (en) | Method, Apparatus and Application Platform for Realizing Logon to an Application Service Website | |
| CN107528858B (en) | Login method, device and equipment based on webpage and storage medium | |
| CN104767775A (en) | Web application message push method and system | |
| WO2013143403A1 (en) | Method and system for accessing website | |
| US11770385B2 (en) | Systems and methods for malicious client detection through property analysis | |
| US20150127838A1 (en) | Page Operation Processing Method and Apparatus, and Terminal | |
| CN104735066A (en) | Single sign-on method, device and system oriented to web page applications | |
| US9473516B1 (en) | Detecting network attacks based on a hash | |
| EP3210107A1 (en) | Method and apparatus for facilitating the login of an account | |
| US11163499B2 (en) | Method, apparatus and system for controlling mounting of file system | |
| US20140019957A1 (en) | Method, apparatus, and system for sharing software among terminals | |
| WO2016070718A1 (en) | Method, device, and browser for file downloading | |
| WO2015021873A1 (en) | Method, platform server, and system of data pushing | |
| CN104683297A (en) | Resource access method and device, server and terminal | |
| WO2014180145A1 (en) | Methods and systems for connecting a mobile device to a network | |
| WO2014094611A1 (en) | Method and device for uploading data to social platform | |
| CN104932910A (en) | Method and system for application program interface extension | |
| CN104346460B (en) | Carry out the method, apparatus and browser client of file download | |
| US9646149B2 (en) | Accelerated application authentication and content delivery | |
| CN110633432A (en) | Method, device, terminal equipment and medium for acquiring data |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 15871709 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 15871709 Country of ref document: EP Kind code of ref document: A1 |