CN112688857A - Method for calling instant messaging function and related equipment - Google Patents

Method for calling instant messaging function and related equipment Download PDF

Info

Publication number
CN112688857A
CN112688857A CN202011444732.1A CN202011444732A CN112688857A CN 112688857 A CN112688857 A CN 112688857A CN 202011444732 A CN202011444732 A CN 202011444732A CN 112688857 A CN112688857 A CN 112688857A
Authority
CN
China
Prior art keywords
instant messaging
calling
login
interface
function
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.)
Pending
Application number
CN202011444732.1A
Other languages
Chinese (zh)
Inventor
林皓
杨大郁
杨海伟
宋萌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing North Source Software Co ltd
Beijing VRV Software Corp Ltd
Original Assignee
Beijing North Source Software Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing North Source Software Co ltd filed Critical Beijing North Source Software Co ltd
Priority to CN202011444732.1A priority Critical patent/CN112688857A/en
Publication of CN112688857A publication Critical patent/CN112688857A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a method for calling an instant messaging function and related equipment, belonging to the technical field of instant messaging, wherein the method comprises the following steps: calling a background interface of instant messaging to obtain a login token of the instant messaging; and calling a webpage service function of the instant messaging and starting a service window of the instant messaging according to the obtained login token so as to perform page operation and control. The invention realizes the interaction and communication specification of the third-party application and the instant communication function by providing the login token of the instant communication for the third-party application, thereby realizing the webpage service function of the instant communication called by the third-party application.

Description

Method for calling instant messaging function and related equipment
Technical Field
The present invention relates to the field of instant messaging technologies, and in particular, to a method for invoking an instant messaging function and a related device.
Background
Instant Messaging (IM) is a process of sending and receiving Instant messages between mobile phones, tablet computers and computer users by using a network, and can transmit information such as characters, pictures, sound, video and the like, and is one of the very popular and popular network applications of the internet. Typical IM applications are WeChat, QQ, Skype, Tencent, and hundred million, where the first three are facing public users and the second two are facing enterprise or organizational users.
At present, in the implementation process of many projects, a third-party application and instant messaging are required to interact, and even a function of embedding instant messaging is required. Under the current situation, no mature scheme is available for realizing single sign-on, smoothly starting instant messaging, calling instant messaging and quitting sign-on after conversation. And only information islands can be formed between the third-party application and the instant messaging for respective calling, and the user experience of integrated processing cannot be realized.
Meanwhile, the third party application calls the public interface provided by the instant messaging, and the problem of safe calling also exists: for example, when caller identity authentication, authority check or single sign-on is carried out and authorized calling is realized, information leakage, eavesdropping prevention and embezzlement prevention can be avoided.
Therefore, a solution is urgently needed to implement the interaction and communication specification of the third-party application and the instant messaging function.
Disclosure of Invention
The invention provides a method for calling an instant messaging function and related equipment, which are used for solving the problem that the function interaction between a third-party application and instant messaging cannot be realized in the prior art and realizing the interaction and communication specification of the third-party application and the instant messaging function.
The invention provides a method for calling an instant messaging function, which comprises the following steps:
calling a background interface of instant messaging to obtain a login token of the instant messaging;
and calling a webpage service function of the instant messaging and starting a service window of the instant messaging according to the obtained login token so as to perform page operation and control.
According to the method for calling the instant messaging function, which is provided by the invention, the instant messaging background interface is called to obtain the login token of the instant messaging, and the method comprises the following steps:
starting an http service process of the instant messaging;
and calling an http service interface of the instant messaging to acquire a client identifier and server information of the instant messaging, wherein the server information comprises domain name information of the instant messaging login.
According to the method for calling the instant messaging function, the http service interface is called to obtain the client identifier and the server information of the instant messaging, and the method comprises the following steps:
if the instant messaging is logged in, judging whether the requested domain name information is consistent with the logged-in server at a client identification interface for acquiring the instant messaging, and if the requested domain name information is inconsistent with the logged-in server, directly returning a request service error;
and if the instant messaging is not logged in, directly returning to the request success, and storing the client identification of the instant messaging so as to be called for a later interface.
According to the method for calling the instant messaging function provided by the invention, the step of acquiring the login token of the instant messaging comprises the following steps:
calling an interface for obtaining an authorization code to apply for the authorization code;
after the authorization code is obtained, calling an interface for obtaining an access token to request the access token;
after the access token is acquired, calling a login token interface for acquiring the login token to request the instant messaging, and transmitting the access token and the client identifier;
and acquiring the login token and the server identification of the instant messaging.
According to the method for calling the instant messaging function provided by the invention, the method for calling the webpage service function of the instant messaging and starting the service window of the instant messaging to perform page operation and control according to the obtained login token comprises the following steps:
calling an http service interface of the instant messaging, and transmitting the login token, the server identifier and the client identifier to execute the user to log in the instant messaging;
and acquiring the information of successful instant messaging login.
According to the method for calling the instant messaging function provided by the invention, the method for calling the webpage service function of the instant messaging and starting the service window of the instant messaging to perform page operation and control according to the obtained login token comprises the following steps:
starting a page chat session or an audio and video request of the instant messaging;
and calling an http service interface of the instant messaging to obtain the login user and the online time of the current instant messaging.
According to the method for calling the instant messaging function provided by the invention, the method for calling the webpage service function of the instant messaging and starting the service window of the instant messaging to perform page operation and control according to the obtained login token comprises the following steps:
opening a function page of the instant messaging, wherein the function page comprises a workbench, an address list and a task notification;
and obtaining the log-out notice of the instant messaging.
The invention also provides a device for calling the instant messaging function, which comprises:
the system comprises an acquisition login token module, a communication module and a communication module, wherein the acquisition login token module is used for calling a background interface of instant communication and acquiring a login token of the instant communication;
and the page operation control module is used for calling the webpage service function of the instant messaging and starting the service window of the instant messaging according to the obtained login token so as to carry out page operation and control.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the steps of calling the instant messaging function method according to any one of the above.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of any of the methods for invoking an instant messaging functionality described above.
The invention provides a method for calling an instant messaging function and related equipment, which realize the interaction and communication specification of a third-party application and the instant messaging function by providing a login token of instant messaging for the third-party application, thereby realizing the calling of the webpage service function of the instant messaging by the third-party application.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is an architecture diagram of the instant messaging function invocation principle provided by the present invention;
FIG. 2 is a flow chart illustrating a method for invoking an instant messaging function according to the present invention;
FIG. 3 is a schematic flow chart of obtaining an instant messenger login token according to the present invention;
FIG. 4 is a second flowchart illustrating a process of obtaining an instant messenger login token according to the present invention;
FIG. 5 is a schematic flow chart of page operation and control for instant messaging according to the present invention;
FIG. 6 is a timing diagram illustrating a method for invoking an instant messaging function according to the present invention;
FIG. 7 is a schematic structural diagram of a device for invoking an instant messaging function according to the present invention;
fig. 8 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
http is a simple request-response protocol that specifies what messages a client may send to a server and what responses it gets. http is a support protocol of www (World Wide Web ), the http protocol is based on B/S (client/server) architecture for communication, server implementation programs of the http protocol include htpd, nginx, and the like, and implementation programs of the client are mainly Web browsers.
The Http protocol is based on the TCP protocol, and when the browser needs to obtain the web page data from the server, an Http request is issued. Http establishes a connection channel to the server through TCP, and Http immediately disconnects TCP after the data required by the request is completed.
The invention provides a method for calling an instant messaging function and related equipment.
The method for invoking the instant messaging function and the related device provided by the invention are described below with reference to fig. 1 to 8.
Fig. 1 is an architecture diagram of the instant messaging function invocation principle provided by the present invention, as shown in the figure. The client is provided with third-party application software and instant messaging software, namely a third-party application client and an instant messaging client. The third-party application client is in communication connection with the third-party application server, and the instant messaging client is in communication connection with the instant messaging server. And the third-party application software and the communication instant communication software log in at the same client.
In order to solve the technical problem of realizing interaction between third-party application and instant messaging, the invention provides the following rules of the solution scheme:
(1) the third-party application realizes single sign-on with instant messaging or realizes synchronization and authentication of a third-party user system with instant messaging, and the third-party application logs in a specific user.
Single Sign On (SSO) is one of the more popular solutions for business integration of enterprises. SSO is defined as the fact that in multiple applications, a user only needs to log in once to access all mutually trusted applications.
(2) Instant messaging is a single instance version, with multiple calls or implicitly all being the same instance. Specifically, the method comprises the following steps:
the same client does not allow a plurality of users to log in simultaneously, and only one user performs service interaction for third-party application.
If the user wants to use other user identities to log in, the user can only log out the current logged-in user and then switch to log in other users, and the logged-out user can perform confirmation prompt operation according to the configuration of the instant communication background.
And thirdly, one user can call the instant messaging function in a plurality of third-party applications as long as the applications are under the same client.
And fourthly, one user is not allowed to log in a plurality of PC clients simultaneously, the current logic is that the user A logs in a certain PC client 1 and then logs in the other PC clients 2 by using the identity of the user A, and then the user A of the client 1 is extruded and the user of the client 2 is prompted.
(3) According to project requirements, instant messaging can be displayed, and hidden dangers can also be found on a desktop; instant messaging is a passive executive, whose initiation, login, user switching, etc. may be performed by third party applications.
(4) The third party application of the client can call the instant messaging function, and specifically comprises the following steps:
first, instant messaging is started, but may not be logged in.
Appointing a certain user to log in, switching to other users to log in, and logging out the current user.
The conversation pages of the login user and other users can be called, and one-to-one conversation can be carried out, or one-to-many conversation can be carried out; instant messaging may be initiated and the session page located and then displayed at a specified location, which may be specified by a third party application.
Optionally, the instant messaging may be based on PC version, but the invention is not limited thereto.
The following describes in detail a solution to the above problem with reference to the accompanying drawings.
Fig. 2 is a schematic flow chart of the method for invoking the instant messaging function provided by the present invention, as shown in the figure. A method of invoking an instant messaging function, comprising:
step 200, calling a background interface of instant messaging to obtain a login token of the instant messaging.
Optionally, the third party application client starts the process of the instant messaging client of the same client, and further obtains the client identifier of the instant messaging and the service information of the instant messaging server by starting the process of the instant messaging client.
Step 202, according to the obtained login token, calling a web service function of the instant messaging and starting a service window of the instant messaging to perform page operation and control.
Optionally, the third-party application client logs in the instant messaging through the login token by obtaining the login token of the instant messaging client. After logging in the instant messaging, the third-party application can call the web service function (such as a workbench, an address book, a task notification and the like) of the instant messaging, and can start the service window of the instant messaging to perform page operation and control, such as starting the chat service window of the instant messaging, performing page operation and control on the chat service window, and also initiating an audio and video session request and the like on the chat service window.
The method for invoking the instant messaging function according to the present invention will be described with reference to specific embodiments. Fig. 3 is a schematic flow chart of obtaining an instant messaging login token according to the present invention, as shown in the figure. In the step 200, the invoking an instant messaging background interface to obtain the login token of the instant messaging includes:
and step 300, starting the http service process of the instant messaging.
Optionally, the third party application client executes a preset instruction (for example, a "Linkdood:// logic" instruction) to start an http service process of the instant messaging client. The preset instruction can be set according to the actual requirement of the project.
If the instant messaging client does not start the thread, starting the thread of the instant messaging client; and if the instant communication client side starts the thread, the third party application client side calls the thread, but the start thread does not log in the instant communication client side.
A thread (thread) is the smallest unit that an operating system can perform arithmetic scheduling. It is included in the process and is the actual unit of operation in the process. A thread refers to a single sequential control flow in a process, multiple threads can be concurrently executed in a process, and each thread executes different tasks in parallel.
Optionally, after the thread of the instant messaging client is started, the instant messaging client internally starts an http service, and uses a local IP + port number, where the port number starts from a preset value (e.g. 22350), and if 22350 is occupied, uses 22351 until 22360, and a maximum of 10 ports can be tried according to actual needs of the project. Wherein, a port (port) is an exit of the client and the server.
The client can find the corresponding server through the IP address, but the server has a plurality of ports, each application program corresponds to one port number, and the client can really access the server through the port number. To distinguish the ports, each port is numbered, i.e., a port number.
Step 302, invoking an http service interface of the instant messaging to obtain a client identifier and server information of the instant messaging, where the server information includes domain name information of the instant messaging login.
Optionally, the third party application client executes an interface for "obtaining a client identifier" in the http service, where the address is local IP +22350, and requests the instant messaging client to obtain the client identifier. If the request times out, the next port number is tried 22351, up to 22360 (according to the preset value, 10 ports are tried at most), if all fail, a prompt of "client identification cannot be obtained" is returned to the third party application client.
Optionally, if the instant messaging is logged in, the client identifier interface obtaining the instant messaging determines whether the requested domain name information is consistent with the logged-in server, and if the requested domain name information is not consistent with the logged-in server, a prompt of "request service error" is directly returned.
If the instant messaging is not logged in, the request success is directly returned without judging whether the requested domain name information is consistent with the logged-in server. And if the interface for acquiring the client identification returns success, the client identification (clientFlag) of the instant messaging is saved so as to be used for calling a subsequent interface.
Fig. 4 is a second flowchart of obtaining an instant messaging login token provided by the present invention, as shown in the figure. In the step 200, the obtaining the login token for the instant messaging includes:
step 400, calling the interface for obtaining authorization code to apply for authorization code.
Optionally, the third party application client requests the third party application server to obtain a login token (token) of the instant messaging. The third party application server executes an "Authorization Code acquisition (authCode) interface, and applies for an Authorization Code from the instant messaging server.
It should be noted that, here, it is required whether to adopt the way of the silent authorization according to the actual requirement of the project. -silent authorization: and the snsapi _ base has no popup window and can only obtain the openid of the user.
Second, non-silent authorization: snsapi _ userinfo, pop-up with a pop-up box requires the user to manually click on the confirmation authorization. Openids, user head images, nicknames, etc. may be obtained.
The third-party application has a user system and an authentication mode thereof, and the third-party application is supposed to log in through a user A:
optionally, if the silent authorization is adopted, user identity information of a third-party application needs to be transmitted to perform user positioning, that is, idToken information of the user a needs to be placed in the header, the cow riding parameter is in the silent authorization mode, an authorization page is not popped up, and only an authorization code of the user a is returned. And the instant messaging server calls an authentication interface of the third-party application to acquire the data of the user A according to the idToken information and generates a returned authorization code.
Optionally, the third-party application uses the user system of the instant messaging, and if the authentication mode of the instant messaging is adopted, that is, the request parameter is non-silent authorization, an authorization page needs to be popped up, and an authorization code of the authorization page for logging in the user a is returned.
Optionally, the third-party application server obtains an authorization code (authCode) of the instant messaging server through a callback function of the interface.
Step 402, after obtaining the authorization code, calling an interface for obtaining an access token to request the access token.
Optionally, the third-party application server calls a background interface of the instant messaging of "obtaining an access token (accessToken)" according to the obtained authorization code, and requests to obtain the access token.
Step 404, after the access token is obtained, a login token interface is called to request the login token of the instant messaging, and the access token and the client identifier are transmitted.
After the instant communication server returns the access Token to the third-party application server, an instant communication background interface for obtaining a login Token (Token) is called, the access Token (accesstken) and the client identifier (clientFlag) are transmitted, and the login Token (logtonken) and the server identifier (serverFlag) are requested to be obtained.
And step 406, obtaining the login token and the server identification of the instant messaging.
And the instant communication server sends a login Token (Token) and a server identification (serverFlag) to the third-party application client.
Optionally, the login Token (Token) is associated with a public number applied by a third party application, and the associated information includes "server identifier (serverFlag) + application ID address (APPid) + client identifier (clientFlag) + timestamp + validity period".
Optionally, the login token (logtonken) is preset according to the system, that is, the login token (logtonken) is only allowed to log in once by default (the login failure times are not counted), and the login token needs to be acquired again in the next login. The invention can also record the login token by the page according to the project requirement, so that the login token is not required to be acquired again in the next login, and the invention is not limited to the method.
Optionally, the login Token needs to be invoked within the validity period, and if the login Token is invalid, the login Token needs to be applied again, and if the login Token is repeatedly applied within the validity period, the same login Token (Token) is returned.
Optionally, the server identifier (serverFlag) is the instant messaging server identifier for the client to log in, which is determined by the APPid requested by the third party application. Because serverFlag is the server identification of the instant messaging, the instant messaging can log on multiple servers, but determines which server to log on for the instant messaging.
Optionally, the third party application client executes a "login instant messaging" interface of the http service of the instant messaging, and transmits the login token, the server identifier and the client identifier to execute the login of the user a to the instant messaging.
In the above interface for executing "login instant messaging", it should be noted that:
(1) and only one single-instance instant communication is allowed to run, if the instant communication process is started, the instant communication is switched to the instant communication of the serverFlag server for user login regardless of whether the instant communication is logged in.
(2) The instant messaging client calls a self background server to verify the validity (including times, validity period, and appid validity) of a login command (logtonken) and a client identifier (clientFlag), and local instant messaging login is performed after the verification is passed.
(3) And after the instant messaging client logs in successfully, returning to a user temporary bill (userTicket) of the third-party application client, and then transmitting the userTicket into all the third-party application clients when the instant messaging function is called. The userTicket is a temporary authorization certificate, and with the certificate, the third-party application can call the interface of the instant messaging to execute the corresponding function.
(4) If the userTicket fails, a method for refreshing the userTicket interface can be called to obtain a new userTicket, and then login tokens (logIntoken) and (clientFlag) are transmitted.
And the instant communication client returns the information of successful instant communication login to the third-party application client. After the instant messaging login is successful, the third-party application can perform page operation and control on the instant messaging.
Fig. 5 is a schematic flow chart of page operation and control for instant messaging according to the present invention, as shown in the figure. The calling the webpage service function of the instant messaging and starting the service window of the instant messaging according to the obtained login token to perform page operation and control comprises the following steps:
step 500, starting a page chat session or an audio/video request of the instant messaging.
Optionally, after the user a logs in the instant messaging, the third-party application client may start a session, so as to implement a one-to-one session or a one-to-many session, for example, a chat between the user a and the user B, a chat between the user C, and a chat between the user D and the third party application client.
Specifically, the third-party application calls a session starting interface in the instant messaging http service, transmits the ID numbers and session titles of the three users, namely user B, user C and user D, locates the sessions between the current user a and the users B, C and D, and returns the sessionID (session ID) of the caller.
Further, the third party application calls a new session user interface in the instant messaging http service, transmits the sessionID and the user E, and adds the user E to the current chat session.
Optionally, the third party application calls a session deletion user interface in the instant messaging http service, transmits the sessionID and the user E, and deletes the user E from the chat session, or the interface may select the user E to be removed in the instant messaging.
Optionally, the sessionID is passed in, and the third party application can pull session data, such as cached history data of instant messaging locally.
Optionally, sessionID is a tag field of the positioning session, and if the session is a one-to-one session, sessionID is a user ID of the other party; the sessionID is the group ID if it is a group session.
Optionally, the third party application may also request the audio-video session from the instant messaging.
Specifically, the third-party application calls a single session starting interface in the instant messaging http service, and transmits the ID of the user B, so that the instant messaging can be started, and an audio/video session request between the current user a and the user B is initiated.
Further, the third party application calls a group session interface in the instant messaging http service, transmits the IDs and session titles of the three users, namely user B, user C and user D, and can also start instant messaging and initiate an audio/video session request between the current user a and the user B, the user C and the user D.
Step 502, calling a login state interface of the instant messaging http service, and acquiring a login user and online time of the current instant messaging.
Optionally, the third-party application calls a login state interface in the instant messaging http service, and can obtain a login user, online time and the like of the current instant messaging. And if the instant messaging client returns the null information to the third-party application client, the instant messaging client indicates that the instant messaging client is not logged in.
Step 504, opening the function page of the instant messaging, wherein the function page comprises a workbench, an address list and a task notification.
Optionally, the page function may include other page functions besides the workbench, the address list and the task notification, and may be specifically set according to project requirements, which is not limited to the present invention.
Step 506, obtaining the log-out notice of the instant messaging.
Optionally, the third-party application client may obtain information that the instant messaging client logs out of the current user.
In summary, the method for invoking the instant messaging function of the present invention can achieve smooth interaction, safe and reliable communication between the third party and the instant messaging, and has the following technical effects:
(1) in order to realize the interaction with the third-party application, an authentication system for interfacing the third-party application is required, and therefore, the identity of the third-party application needs to be authorized and authenticated. Therefore, the invention realizes the safe communication between the third-party application and the instant communication, and the functions of the instant communication which are open to the outside can be safely called by the third-party application; the possibility and range of instant messaging and third party application function embedding is expanded.
(2) Because the invention realizes the safe communication between the third-party application and the instant messaging, the application scene (the application scene is described in detail in the embodiment provided below) and the application range of the instant messaging are improved, the instant messaging can be used as the whole instant messaging solution to provide services for the outside, and a plug-in mode can be adopted to meet the requirement of large-scale engineering or a platform to realize the local communication function.
The method for invoking the instant messaging function according to the present invention will be described with a specific embodiment.
Fig. 6 is a timing diagram of the method for invoking the instant messaging function provided by the present invention, as shown in the figure.
The figure shows user a, a third party application client, a third party application server, an instant messaging client and an instant messaging server.
Step 1, a third party application starts instant messaging at the same client, and can start the instant messaging by executing a preset command, such as "linkdood: a/logic command to start the process of instant messaging.
And 2, instant communication starts http service by using a local IP + port number.
And 3, calling an http service interface by the third-party application client to acquire the client identification and the server information of the instant messaging. The server information includes domain name information for instant messaging.
And 4, the instant communication client returns the client identification and the server information to the third-party application client.
And 5, the third-party application client requests the third-party application server to acquire the instant communication login token.
And 6, the third-party application server calls the interface for obtaining the authorization code and applies for the authorization code from the instant messaging server.
Optionally, in this step, it is required to perform corresponding operations according to whether the project requires a silent authorization manner, which is described above specifically.
And 7, the instant communication server returns the authorization code information to the third-party application server through the callback function.
And 8, calling an interface for acquiring the access token by the third-party application server, and requesting the access token from the instant messaging server.
And 9, the instant communication server returns an access token to the third-party application server.
And step 10, the third-party application server calls an interface for acquiring the login token, requests the login token of the instant messaging from the instant messaging server, and inputs the access token and the client identifier.
And step 11, the instant messaging server returns a login token to the third-party application client.
And step 12, the third-party application client calls the http service interface to log in the instant messaging of the client, and transmits a login token and a client identifier to log in the instant messaging of the client.
And step 13, the instant messaging client returns the information of successful instant messaging login to the third-party application client.
Step 14, the third party application client calls the chat session of the login user A and other users to the instant communication client.
And step 15, the third-party application client starts the audio and video requests of the login user A and other users to the instant messaging client.
It is understood that the third party application client can also perform other page operations and controls on instant messaging, and the invention is not limited to initiating chat sessions and audiovisual requests.
And step 16, the instant messaging client executes a background task or a passive function initiated by a third-party application client, such as called audio and video.
And step 17, the third-party application client calls an http service interface to acquire an instant communication state, such as a login user and online time.
Step 16, the third party application client can obtain the information that the current user a of the instant messaging client logs out.
In summary, the method for calling the instant messaging function provided by the invention realizes the interaction and communication specification of the third party application and the instant messaging function.
Based on the technical solution provided by the present invention, specific embodiments are provided below for various usage scenarios of the present invention, and the following description is provided:
example 1: one user uses instant messaging functionality with multiple third party applications.
(1) The software running state:
the software running on the PC side is as follows:
and (6) instant messaging, wherein the user A is logged in.
And secondly, the third-party application 1 is that the user A logs in and calls an instant messaging function through userTicket 1.
And thirdly, the third-party application 2 is that the user A logs in and does not acquire userTicket.
The userTicket is a temporary authorization certificate, and with the certificate, the third-party application can call the interface of the instant messaging to execute the corresponding function.
(2) The execution flow comprises the following steps:
the third-party application 2 acquires the login token corresponding to the third-party application 2 through the login token acquisition interface, and the login tokens of the third-party application 1 and the third-party application 2 are different, and are different applications although the same user A is used.
And secondly, the third-party application 2 calls a login instant communication interface of the http service to perform instant communication login, if the instant communication internal judgment is that the user logs in, no login operation is performed, and a new userTicket is generated and returned to the third-party application 2.
And thirdly, the third-party application 1 and the third-party application 2 can play an instant messaging function through own userTicket call.
And fourthly, no conflict exists between the two third-party application function calls, for example, the chat sessions of the third-party application function calls are called simultaneously, and the two third-party application function calls do not affect each other.
(2) Principle explanation:
the method comprises the following steps that firstly, a plurality of third-party applications can use the same user to call an instant messaging call function, and because the third-party applications are different, loginToken and userTicket are different.
And secondly, instant messaging can support a plurality of third-party applications to call the same function without conflict.
Embodiment 2. logging out of multiple applications by one user.
(1) The software running state:
the software running on the PC side is as follows:
instant messaging that user A has logged in
② the third party application 1, the web user A is logged in and has called the instant communication function through userTicket 1.
Third party application 2 web user a has logged in and has invoked instant messaging functionality through userTicket 2.
(2) The execution flow comprises the following steps:
the third-party application 1 calls an exit login interface of the http service to execute exit login of the user A, at this time, the userTicket1 is invalid, the userTicket2 is still valid, and the user A in instant messaging still has a login state.
And secondly, the third-party application 2 calls an exit login interface of the http service to execute exit login of the user A, the userTicket2 fails, the instant messaging judges whether all userTicks fail, and if so, the instant messaging exits login.
(3) Principle explanation:
the userTicket depends on the login of the instant messaging, and if the instant messaging logs out, all the userTicks are invalid.
And secondly, a certain third-party application quits logging, only represents that the third-party application can not call the instant messaging function, and does not influence other third-party applications.
Example 3 a third party application employs its own authentication framework and obtains a login token (token).
(1) The software running state:
the software running on the PC side is as follows:
and (6) instant messaging, wherein the state is unknown.
And the web third party application is that the web user A is logged in.
(2) Scene description:
the third-party web application is a self-owned user and organization mechanism and a self-owned user authentication system.
And secondly, the user and the organization mechanism of the web third-party application need to be synchronized in the instant messaging, and an interface of the web third-party application needs to be called for user authentication in an instant messaging background.
And thirdly, the instant messaging background and the web third-party application background network are intercommunicated, and background services can be mutually invoked.
(3) The execution flow comprises the following steps: :
the method comprises the steps that firstly, a web third-party application client starts a PC-side instant messaging process, an IP + port number of http service is obtained through a polling client identification obtaining interface, and meanwhile, a client identification clientFlag is obtained.
And secondly, the web third-party application client requests to obtain a login token (token) of the instant messaging from the server of the client, and transmits a client identification clientFlag.
③ the server of the web third party application first obtains the authentication token (token) information (such as idtoken) of user a.
And fourthly, the web third-party application calls an Authorization Code acquisition (Authorization Code) interface of the instant messaging server, adopts a silent Authorization mode, adds an identifier 213412421 into a header of a data packet of the http request, and applies for an Authorization Code acquisition.
Inside the instant communication server, the interface for acquiring Authorization Code executes the following steps:
step 1: and judging whether the header contains three-party authentication information (idtoken) or not, and if so, adopting a silent mode by default.
Step 2: and calling an interface of a third-party application to verify the validity of the idtoken, and finally acquiring user data, such as the data of the user A.
And step 3: and judging whether the user A has authority detection in the user system of the instant communication.
And 4, step 4: if no permission detection exists, an authorization code (authCode) for user A is generated and returned to the third party application.
And invoking an instant communication background interface for acquiring an access token (accessoken) by the web third-party application background (namely the third-party application server) according to the acquired authorization code to acquire the accessoken.
And the web third-party application calls an instant communication background interface of the 'acquisition login Token', transmits an access Token (accessToken) and a client identifier (clientFlag), acquires a login Token (logtoken) and a server identifier (server flag), and transmits the login Token and the server flag to the third-party application client.
And the web third-party application client side can carry out instant messaging login according to the acquired login token.
(4) Principle explanation:
firstly, the Authorization Code returned by the interface of the Authorization Code is acquired to correspond to the user identity, because the user identity can only be transmitted by the third party through the parameters if the third party is the web third party application which is logged in by the third party.
Secondly, logging in the token relates to the client, and a client identifier (clientFlag) needs to be transmitted.
In summary, the third-party application of the present invention is not limited to the third-party application of wed, and may also be an instant messaging application or other third-party applications, and the present invention is not limited thereto.
The device for invoking the instant messaging function provided by the present invention is described below, and the device for invoking the instant messaging function described below and the method for invoking the instant messaging function described above may be referred to correspondingly.
Fig. 7 is a schematic structural diagram of the device for invoking an instant messaging function according to the present invention, as shown in the figure. The device 700 for calling the instant messaging function comprises a login token obtaining module 702 and a page operation control module 704. Wherein the content of the first and second substances,
the login token obtaining module 702 is configured to invoke a background interface of the instant messaging to obtain a login token of the instant messaging.
The page operation control module 704 is configured to invoke the web service function of the instant messaging and start the service window of the instant messaging according to the obtained login token to perform page operation and control.
Fig. 8 illustrates a physical structure diagram of an electronic device, and as shown in fig. 8, the electronic device may include: a processor (processor)810, a communication Interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication Interface 820 and the memory 830 communicate with each other via the communication bus 840. The processor 810 may invoke logic instructions in the memory 830 to perform the steps of the method of invoking an instant messaging function described above.
In addition, the logic instructions in the memory 830 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which 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) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the steps of the method for invoking instant messaging functionality provided above.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor is implemented to perform the steps of the method for invoking an instant messaging function provided above.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for invoking an instant messaging function, comprising:
calling a background interface of instant messaging to obtain a login token of the instant messaging;
and calling a webpage service function of the instant messaging and starting a service window of the instant messaging according to the obtained login token so as to perform page operation and control.
2. The method of claim 1, wherein the invoking an instant messaging background interface to obtain the login token for the instant messaging comprises:
starting an http service process of the instant messaging;
and calling an http service interface of the instant messaging to acquire a client identifier and server information of the instant messaging, wherein the server information comprises domain name information of the instant messaging login.
3. The method according to claim 2, wherein the invoking the http service interface to obtain the client identifier and the server information of the instant messaging comprises:
if the instant messaging is logged in, judging whether the requested domain name information is consistent with the logged-in server at a client identification interface for acquiring the instant messaging, and if the requested domain name information is inconsistent with the logged-in server, directly returning a request service error;
and if the instant messaging is not logged in, directly returning to the request success, and storing the client identification of the instant messaging so as to be called for a later interface.
4. The method of claim 1, wherein obtaining the login token for the instant communication comprises:
calling an interface for obtaining an authorization code to apply for the authorization code;
after the authorization code is obtained, calling an interface for obtaining an access token to request the access token;
after the access token is acquired, calling a login token interface for acquiring the login token to request the instant messaging, and transmitting the access token and the client identifier;
and acquiring the login token and the server identification of the instant messaging.
5. The method according to claim 4, wherein the calling the web service function of the instant messaging and starting the service window of the instant messaging to perform page operation and control according to the obtained login token comprises:
calling an http service interface of the instant messaging, and transmitting the login token, the server identifier and the client identifier to execute the user to log in the instant messaging;
and acquiring the information of successful instant messaging login.
6. The method according to claim 1, wherein the calling the web service function of the instant messaging and starting the service window of the instant messaging to perform page operation and control according to the obtained login token comprises:
starting a page chat session or an audio and video request of the instant messaging;
and calling an http service interface of the instant messaging to obtain the login user and the online time of the current instant messaging.
7. The method according to claim 1, wherein the calling the web service function of the instant messaging and starting the service window of the instant messaging to perform page operation and control according to the obtained login token comprises:
opening a function page of the instant messaging, wherein the function page comprises a workbench, an address list and a task notification;
and obtaining the log-out notice of the instant messaging.
8. An apparatus for invoking an instant messaging function, comprising:
the system comprises an acquisition login token module, a communication module and a communication module, wherein the acquisition login token module is used for calling a background interface of instant communication and acquiring a login token of the instant communication;
and the page operation control module is used for calling the webpage service function of the instant messaging and starting the service window of the instant messaging according to the obtained login token so as to carry out page operation and control.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method for invoking an instant messaging function according to any one of claims 1 to 7 when executing the program.
10. A non-transitory computer readable storage medium, having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the steps of the method of invoking an instant messaging function according to any one of claims 1 to 7.
CN202011444732.1A 2020-12-08 2020-12-08 Method for calling instant messaging function and related equipment Pending CN112688857A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011444732.1A CN112688857A (en) 2020-12-08 2020-12-08 Method for calling instant messaging function and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011444732.1A CN112688857A (en) 2020-12-08 2020-12-08 Method for calling instant messaging function and related equipment

Publications (1)

Publication Number Publication Date
CN112688857A true CN112688857A (en) 2021-04-20

Family

ID=75448456

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011444732.1A Pending CN112688857A (en) 2020-12-08 2020-12-08 Method for calling instant messaging function and related equipment

Country Status (1)

Country Link
CN (1) CN112688857A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114285897A (en) * 2021-12-22 2022-04-05 杭州安恒信息技术股份有限公司 Application docking method, device, system, electronic equipment and readable storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1719823A (en) * 2004-07-08 2006-01-11 腾讯科技(深圳)有限公司 Method for directly alternating information with instant communication system on web page
CN101540674A (en) * 2008-03-17 2009-09-23 北京亿企通信息技术有限公司 Method for logging on Web end in instant communication device
CN102752230A (en) * 2011-04-22 2012-10-24 腾讯科技(深圳)有限公司 Method and system for sharing subscriber relationship chain
CN103297325A (en) * 2013-05-13 2013-09-11 北京小米科技有限责任公司 Method, device and equipment for interacting with third-party application in instant messaging system
WO2014193896A2 (en) * 2013-05-28 2014-12-04 Raytheon Company Message content ajudication based on security token
CN106612265A (en) * 2015-10-27 2017-05-03 阿里巴巴集团控股有限公司 Instant messaging method and server
CN107196843A (en) * 2016-03-15 2017-09-22 百度在线网络技术(北京)有限公司 A kind of method and apparatus of instant messaging
CN108733991A (en) * 2017-04-19 2018-11-02 腾讯科技(深圳)有限公司 Web application access method and device, storage medium
CN109600306A (en) * 2019-01-22 2019-04-09 腾讯科技(深圳)有限公司 Create the method, apparatus and storage medium of session
CN111064757A (en) * 2020-03-18 2020-04-24 腾讯科技(深圳)有限公司 Application access method and device, electronic equipment and storage medium
CN111556006A (en) * 2019-12-31 2020-08-18 远景智能国际私人投资有限公司 Third-party application system login method, device, terminal and SSO service platform

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1719823A (en) * 2004-07-08 2006-01-11 腾讯科技(深圳)有限公司 Method for directly alternating information with instant communication system on web page
CN101540674A (en) * 2008-03-17 2009-09-23 北京亿企通信息技术有限公司 Method for logging on Web end in instant communication device
CN102752230A (en) * 2011-04-22 2012-10-24 腾讯科技(深圳)有限公司 Method and system for sharing subscriber relationship chain
CN103297325A (en) * 2013-05-13 2013-09-11 北京小米科技有限责任公司 Method, device and equipment for interacting with third-party application in instant messaging system
WO2014193896A2 (en) * 2013-05-28 2014-12-04 Raytheon Company Message content ajudication based on security token
CN106612265A (en) * 2015-10-27 2017-05-03 阿里巴巴集团控股有限公司 Instant messaging method and server
CN107196843A (en) * 2016-03-15 2017-09-22 百度在线网络技术(北京)有限公司 A kind of method and apparatus of instant messaging
CN108733991A (en) * 2017-04-19 2018-11-02 腾讯科技(深圳)有限公司 Web application access method and device, storage medium
CN109600306A (en) * 2019-01-22 2019-04-09 腾讯科技(深圳)有限公司 Create the method, apparatus and storage medium of session
CN111556006A (en) * 2019-12-31 2020-08-18 远景智能国际私人投资有限公司 Third-party application system login method, device, terminal and SSO service platform
CN111064757A (en) * 2020-03-18 2020-04-24 腾讯科技(深圳)有限公司 Application access method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114285897A (en) * 2021-12-22 2022-04-05 杭州安恒信息技术股份有限公司 Application docking method, device, system, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN108901022B (en) Micro-service unified authentication method and gateway
US11196739B2 (en) Authorization activation
US8275892B2 (en) Low-level remote sharing of local devices in a remote access session across a computer network
EP3723341B1 (en) Single sign-on for unmanaged mobile devices
US8578465B2 (en) Token-based control of permitted sub-sessions for online collaborative computing sessions
US10764430B2 (en) Calling an unready terminal
US10148522B2 (en) Extension of authorization framework
CN112468481B (en) Single-page and multi-page web application identity integrated authentication method based on CAS
MX2009002288A (en) Distributable, scalable, pluggable conferencing architecture.
CN103905779B (en) Method, system and server are held in video conference
WO2011115984A2 (en) Pluggable token provider model to implement authentication across multiple web services
US9300808B2 (en) Method and system for interoperation between multiple conference systems
WO2017036365A1 (en) Voice communication processing method, electronic device, system and storage medium
US11736611B2 (en) Visual engagement using automatically dynamically selected visualization mediums
US20070136793A1 (en) Secure access to a common session in a composite services delivery environment
CN108809807B (en) Creating communication sessions in heterogeneous systems
CN112688857A (en) Method for calling instant messaging function and related equipment
WO2013067701A1 (en) Conference control method and device
US10412124B2 (en) Initiating a server-directed communication session
CN112615876B (en) Method and device for live broadcasting in conference
KR20130043640A (en) One-way information transfer for performing secure information updates
WO2015188453A1 (en) Client access method and device
WO2016062755A1 (en) Apparatus for establishing real-time media sessions in a conversation in a unified and consistent multimodal communication framework

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210420