Jsbridge-based application access method and system

By combining the jsbridge middleware and the open platform, interaction between H5 applications and native advanced functions is realized, solving the problems of difficult interaction and complex integration in traditional methods, and providing a secure and reliable access process and advanced function calls.

CN114462013BActive Publication Date: 2025-12-23INSPUR SOFTWARE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210075854.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-23
Publication Date
2025-12-23
Estimated Expiration
2042-01-23

AI Technical Summary

Technical Problem

Traditional H5 applications have difficulty interacting with native functions, cannot achieve advanced function integration, and lack standardized application access rules, resulting in high integration complexity and insufficient openness.

Method used

The application access method and system based on jsbridge are adopted. Through the jsbridge middleware and open platform, multiple bridging methods are configured to realize the authorization and user information acquisition of H5 applications, support single sign-on and native advanced function calls, and encrypt data transmission in accordance with the OAuth 2.0 protocol.

Benefits of technology

It enables interaction between H5 applications and native advanced functions, provides a standardized access process, improves the freedom and security of the open platform, and ensures privacy and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114462013B_ABST
    Figure CN114462013B_ABST
Patent Text Reader

Abstract

The application discloses an application access method and system based on jsbridge, belongs to the technical field of H5 application access, and aims to solve the technical problem of how to realize the interaction between a native H5 application and a native advanced function.For a user as an individual, the method comprises the following steps: based on registration information of the H5 application, the H5 application is audited through an open platform, and authorization information is returned; and based on the authorization information, the H5 application is authorized.For a user as an enterprise, the method comprises the following steps: based on registration information of the H5 application, the H5 application is audited and authorized through the open platform, and authorization information is returned; a user ID is obtained from the open platform based on a login-free code code and an access_token; the open platform and a jsbridge middleware are called; and a bridging method configured in the jsbridge middleware is used to realize a business function.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of H5 application access, in particular to an application access method and system based on jsbridge. BACKGROUND

[0002] With the development of computer technology, software technology is becoming more and more perfect, and more and more businesses are realized through software technology. The vigorous development of software technology brings us a lot of convenience, but there are many types of software, and each software has its own application scenario, which brings more and more application software and more and more account passwords, which makes people bring new troubles while bringing convenience to people.

[0003] The traditional method has the following disadvantages:

[0004] First, since javascript cannot directly call the capabilities provided by native itself, it is difficult for H5 to interact with native functions;

[0005] Second, since the traditional jsbridge only supports simple calling of the basic functions of the original terminal device, it does not support the integration of complex functions such as instant messaging and task management, resulting in a high technical threshold;

[0006] Third, due to the lack of standard application access rules, the integration of new applications on the unified platform is too complex and the open ability is insufficient.

[0007] The platform capable of integrating applications has scalability, users can integrate any application according to their needs, and can realize free classification and unified management. In view of the advantages of the integration platform, how to make the accessed H5 application realize single sign-on, call the original function of the mobile terminal device and the advanced function of the platform is a technical problem to be solved. SUMMARY

[0008] The technical task of the application is to solve the above problems, and provide an application access method and system based on jsbridge, which solves the problem of how to realize the interaction between the original H5 application and the original advanced function.

[0009] In a first aspect, the application provides an application access method based on jsbridge, which is applied to a system including jsbridge middleware and an open platform, and the jsbridge middleware is configured with a plurality of bridging methods;

[0010] For a user as an individual, the method comprises the following steps:

[0011] Based on the registration information of the H5 application, the H5 application is audited through the open platform, and authorization information is returned.

[0012] In the APP system opens the H5 application, judges whether the application address of the H5 application is spliced with the parameter code, if not, provides the authorization page through the APP system, obtains the authorization of the user as an individual based on the authorization page, and splices the parameter code after the application address of the H5 application based on the authorization;

[0013] If the application address of the H5 application is spliced with the parameter code, submit the request parameter to the open platform to obtain token and refreshToken, the validity period of refreshToken is longer than that of token, when token has exceeded the validity period but refreshToken is within the validity period, refresh token through refreshToken, after refreshToken expires, resubmit the request parameter to the open platform to obtain token and refreshToken;

[0014] Based on token as a request parameter, obtain user information, and call the open platform and jsbridge middleware, implement business functions based on the bridging method configured in the jsbridge middleware;

[0015] For the user as an enterprise, the method comprises the following steps:

[0016] Based on the registration information of the H5 application, the H5 application is audited and authorized through the open platform, and the authorization information is returned;

[0017] Call jsbridge middleware, obtain the login-free code code through jsbridge middleware, and obtain access_token from the open platform based on the authorization information;

[0018] Based on the login-free code code and access_token, obtain user_id from the open platform, obtain user information based on user_id, and call the open platform and jsbridge middleware, implement business functions based on the bridging method configured in the jsbridge middleware.

[0019] As a preferred, the data involved in the bridging method is transmitted by https encryption and the data interface parameter is encrypted;

[0020] For the user as an individual, the H5 application and the open platform follow the Oauth2.0 protocol in the docking process.

[0021] As a preferred, the registration information comprises:

[0022] Application name, the application name is the name of the H5 application to be accessed to the APP system;

[0023] application icon, the application icon being a name of an H5 application to be accessed in the APP system;

[0024] application address, the application address being an access address of the H5 application to be accessed in the APP system.

[0025] As preferred, jsbridge middleware is called to obtain the login-free code code through the jsbridge middleware, including the following steps:

[0026] The jsbridge middleware is introduced in the H5 application;

[0027] The login-free code obtaining function in the jsbridge middleware is called to obtain the login-free code code.

[0028] As preferred, for a user as an individual, after the H5 application is audited by the open platform, the returned authorization information includes AppId, AppCode and AppSecret;

[0029] After the parameter code is spliced after the application address of the H5 application, the AppId, code and grantType are signed to obtain a signature value as a request parameter, and the token and refreshToken are obtained from the open platform;

[0030] When the token has exceeded the valid period but the refreshToken is within the valid period, the refreshToken is used to refresh the token, and the operation is as follows: the grantType is replaced by the refreshToken, the AppId, code and refreshToken are signed to obtain a signature value as a request parameter, and the token and refreshToken are obtained from the open platform again;

[0031] After the refreshToken expires, the AppId, code and grantType are signed to obtain a signature value as a request parameter, and the token and refreshToken are obtained from the open platform again;

[0032] The signature rule is as follows:

[0033] The parameters key are sorted in the ASCII code table order;

[0034] The signature string is spliced in the manner of key1=value1&key2=value2, wherein the null value and the sign field are eliminated;

[0035] Hashing the signature string with the sha256 algorithm to obtain hash;

[0036] Signing the hash with the private key provided by the APP system to the third-party application using RSA SSA-PKCS1-V1_5-SIGN;

[0037] The authentication center verifies the signature using the application public key, and the private key is the appSecret obtained during application registration.

[0038] As a preferred, for users as an enterprise, the authorization information includes APP identification APPID, APPKey, APP authorization code APPCord and APP secret APPSecret; the H5 application obtains access_token from the open platform with the authorization information as the request parameter.

[0039] For users as third-party enterprises, based on the registration information of the H5 application, the H5 application is audited and authorized through the open platform, and the authorization information is returned, including the following steps:

[0040] Submit the registration information and callback URL to the open platform;

[0041] The open platform audits the registration information and returns the first authorization information to the H5 application, which includes AppId, SuiteKey and signature key SuiteSecret, and returns the second authorization information to the H5 application through the callback URL, which includes temporary authorization code AuthCode and authorization application enterprise AuthCorpId;

[0042] After the audit is passed, the SuiteTicket is pushed to the H5 application through the callback URL at regular intervals until the H5 application returns the encrypted string "success" to the open platform;

[0043] The first authorization information, the second authorization information and the SuiteTicket constitute the authorization information returned by the open platform;

[0044] For users as third-party enterprises, based on the authorization information, access_token is obtained from the open platform, including the following steps:

[0045] Take the timestamp+”\n”+suiteTicket as the signature string, take the suiteSecret as the signature key, and use the algorithm HmacSHA256 to calculate the signature value signature;

[0046] Obtain the access_token from the open platform with suiteTicket, timestamp, and signature as the headers parameter, and with suiteKey and authCorpId as the request parameter.

[0047] In a second aspect, the jsbridge-based application access system comprises:

[0048] The jsbridge middleware is configured to implement business interaction based on the bridging method, and to obtain the password-free login code code based on the password-free login code obtaining function, and return the password-free login code code to the H5 application.

[0049] The open platform comprises a foreground interface and a background server, the foreground interface is configured to interact with administrators and developers, the developers submit registration information through the foreground interface, the H5 application is audited based on the registration information and the administrators through the foreground interface, and the authorization information is returned to the H5 application.

[0050] For a user as an individual, the background server is configured to return the token and the refreshToken to the H5 application based on the request parameter, the validity period of the refreshToken is longer than that of the token, the token is refreshed through the refreshToken when the token has exceeded the validity period but the refreshToken is within the validity period, and the background server is configured to return the token and the refreshToken to the H5 application again based on the submitted request parameter after the refreshToken expires; the background server cooperates with the jsbridge middleware to implement the business function based on the bridging method configured in the jsbridge middleware.

[0051] For a user as an enterprise, the background server is configured to authorize the H5 application based on the authorization information, and to return the user_id based on the password-free login code code and the access_token submitted by the H5 application, so as to obtain the user information by the H5 application; the background server cooperates with the jsbridge middleware to implement the business function based on the bridging method configured in the jsbridge middleware.

[0052] The system accesses the H5 application to the APP system and obtains the user information through the jsbridge-based application access method, and implements the interaction between the H5 application and the native advanced function of the APP system based on the bridging method configured in the jsbridge middleware.

[0053] As preferred, the data involved in the bridging method are all transmitted with https encryption and data interface parameter encryption.

[0054] For users as individuals, the H5 application complies with the Oauth2.0 protocol in the process of interfacing with the open platform of the open platform.

[0055] The registration information includes:

[0056] The application name is the name of the H5 application to be accessed to the APP system.

[0057] The application icon is the name of the H5 application to be accessed to the APP system.

[0058] The application address is the access address of the H5 application to be accessed to the APP system.

[0059] As preferred, for users as individuals, the returned authorization information includes AppId, AppCode and AppSecret after the H5 application is audited through the foreground interface.

[0060] After the application address of the H5 application is spliced with the parameter code, the signature value obtained by signing the AppId, code and grantType is used as the request parameter, and the platform server is used to return the token and refreshToken based on the request parameter.

[0061] When the token has exceeded the valid period, but the refreshToken is within the valid period, the refreshToken is used to refresh the token, and the operation is: replacing the grantType with refreshToken, signing the AppId, code and refreshToken, and obtaining the signature value as the request parameter to obtain the token and refreshToken from the open platform again.

[0062] After the refreshToken expires, the signature value obtained by signing the AppId, code and grantType is used as the request parameter to obtain the token and refreshToken from the open platform again.

[0063] The signature rule is as follows:

[0064] The parameters key are sorted in the ASCII code table order.

[0065] The signature string is spliced in the manner of key1=value1&key2=value2, wherein the null value and the sign field are eliminated.

[0066] Hash the signature string by using the sha256 algorithm to obtain hash;

[0067] Sign the hash by using the private key provided by the APP system to the third-party application by using RSA SSA-PKCS1-V1_5-SIGN;

[0068] The authentication center verifies the signature by using the application public key, and the private key is the appSecret obtained when the application is registered.

[0069] As preferred, for the user in the enterprise, the authorization information includes an APP identifier APPID, an APPKey, an APP authorization code APPCord, and an APP secret APPSecret.

[0070] The H5 application takes the authorization information as a request parameter, and the background server is configured to return an access_token to the H5 application based on the request parameter.

[0071] For the user as a third-party enterprise, based on the submitted registration information and the callback URL, the background server is configured to return first authorization information to the H5 application, the first authorization information includes an AppId, a SuiteKey, and a signature key SuiteSecret, and return second authorization information to the H5 application through the callback URL, the second authorization information includes a temporary authorization code AuthCode and an authorized application enterprise AuthCorpId; after the audit is passed, the background server is configured to push SuiteTicket to the H5 application through the callback URL until the H5 application returns the encrypted string "success" to the open platform; and based on the headers parameter and the request parameter submitted by the H5 application, the background server is configured to return an access_token to the H5 application.

[0072] The headers parameter includes suiteTicket, a timestamp timestamp, and a signature value signature, the request parameter includes suiteKey and authCorpId, and the signature value signature is obtained by taking the timestamp timestamp+" \ n"+suiteTicket as a signature string, taking suiteSecret as a signature key, and calculating by using an algorithm HmacSHA256.

[0073] The headers parameter includes suiteTicket, a timestamp timestamp, and a signature value signature, the request parameter includes suiteKey and authCorpId, and the signature value signature is obtained by taking the timestamp timestamp+" \ n"+suiteTicket as a signature string, taking suiteSecret as a signature key, and calculating by using an algorithm HmacSHA256.

[0074] The application access method and system based on jsbridge have the following advantages:

[0075] 1. Using Jsbridge middleware as the foundation for connecting JavaScript and native code, Jsbridge middleware is configured with various bridging methods. Based on the registration information of H5 applications, the open platform reviews and authorizes H5 applications, enabling H5 applications to access the APP system and obtain user information. Jsbridge middleware is configured with various bridging methods. The open platform and Jsbridge middleware work together to realize the interaction between native H5 applications and native advanced functions.

[0076] 2. When reviewing and authorizing H5 applications through the open platform, the review and authorization process for individual users, internal enterprise users, and third-party enterprise users are different, enabling H5 applications to access the APP system in different business scenarios. A standardized process is provided for each scenario.

[0077] 3. Jsbridge middleware is configured with a variety of bridging methods, supporting multi-framework (Vue, Angular, React, etc.), which improves the freedom and openness of the open platform;

[0078] 4. All data involved in the bridging method is transmitted with HTTPS encryption and data interface parameters are encrypted to protect communication from being eavesdropped or stolen by third parties. Furthermore, during the integration process, third-party companies follow the OAuth 2.0 protocol and use time-sensitive access tokens as parameters for obtaining data, further ensuring privacy and security. Attached Figure Description

[0079] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0080] The invention will be further described below with reference to the accompanying drawings.

[0081] Figure 1 This is a flowchart of the application access method based on jsbridge in Example 1, corresponding to individual users;

[0082] Figure 2 This is a flowchart illustrating the internal process of the enterprise in the application access method based on jsbridge in Example 1.

[0083] Figure 3 This is a flowchart of the process for third-party enterprises in the application access method based on jsbridge in Example 1. Detailed Implementation

[0084] The application will be further described below in connection with the drawings and specific embodiments so that those skilled in the art can better understand the application and implement it, but the embodiments are not intended to limit the application, and the embodiments and technical features in the embodiments can be combined with each other without conflict.

[0085] The embodiments of the application provide a jsbridge-based application access method and system, which are used for solving the technical problem of how to realize the interaction between a native H5 application and a native advanced function.

[0086] Embodiment 1:

[0087] The jsbridge-based application access method of the application is applied to a system including a jsbridge middleware and an open platform, and a plurality of bridging methods are configured in the jsbridge middleware.

[0088] For a user as an individual, the method comprises the following steps:

[0089] S100, based on registration information submitted by an H5 application, the H5 application is audited by an open platform, and authorization information of the open platform is returned;

[0090] S200, an H5 application is opened in an APP system, whether a parameter code is spliced after an application address of the H5 application is judged, if not, an authorization page is provided by the APP system, authorization of a user as an individual is obtained based on the authorization page, and the parameter code is spliced after the application address of the H5 application based on the authorization;

[0091] S300, if the parameter code is spliced after the application address of the H5 application, a request parameter is submitted to the open platform to obtain a token and a refreshToken, the validity period of the refreshToken is longer than that of the token, when the token has exceeded the validity period but the refreshToken is within the validity period, the token is refreshed through the refreshToken, and after the refreshToken expires, the request parameter is resubmitted to the open platform to obtain the token and the refreshToken;

[0092] S400, based on the token as a request parameter, user information is obtained, after the H5 application is accessed, single sign-on can be performed between the H5 application and a development platform, and the open platform and the jsbridge middleware are called, and a bridging method configured in the jsbridge middleware is used to realize a business function.

[0093] The registration information includes an application name, an application icon, and an application address, the application name is the name of the H5 application to be accessed to the APP system, the application icon is the name of the H5 application to be accessed to the APP system, and the application address is the access address of the H5 application to be accessed to the APP system.

[0094] For a user as an individual, after the H5 application is audited through the open platform, the returned authorization information includes AppId, AppCode, and AppSecret.

[0095] After the application address of the H5 application is concatenated with the parameter code, the signature value obtained by signing the AppId, code, and grantType is used as a request parameter to obtain the token and refreshToken from the open platform; when the token has exceeded the valid period but the refreshToken is within the valid period, the refreshToken is used to refresh the token, and the operation is as follows: the grantType is replaced by refreshToken, the signature value obtained by signing the AppId, code, and refreshToken is used as a request parameter, and the token and refreshToken are obtained from the open platform again; after the refreshToken expires, the signature value obtained by signing the AppId, code, and grantType is used as a request parameter to obtain the token and refreshToken from the open platform again.

[0096] For the refreshToken, when the code is obtained, the interface for requesting the token is called, the parameter grantType is the way to obtain the token, and authorizationCode or refreshToken needs to be transmitted; if authorizationCode is transmitted, it means that the code is used for obtaining, and if refreshToken is transmitted, it means that the refreshToken is used for obtaining; when the refreshToken is obtained for the first time, the code is used for obtaining, and the token and refreshToken are obtained, the expiration time of the token is short, the expiration time of the refreshToken is long, the so-called refreshing of the token means that when the token expires, the refreshToken is used to request the token again, and the code does not need to be used again.

[0097] The signature rule is as follows:

[0098] (1) The parameters key are sorted in the ASCII code table order;

[0099] (2) concatenate the signature string in the form of key1=value1&key2=value2, wherein the null value and the sign field are removed;

[0100] (3) hash the signature string by using the sha256 algorithm to obtain a hash;

[0101] (4) sign the hash by using the RSASSA-PKCS1-V1_5-SIGN based on the private key provided by the APP system to the third-party application;

[0102] (5) the authentication center verifies the signature by using the application public key, and the private key is the appSecret obtained when the application is registered.

[0103] The H5 application and the open platform follow the Oauth2.0 protocol in the connection process.

[0104] For the user as an enterprise, the method comprises the following steps:

[0105] Step 1, based on the registration information of the H5 application, the H5 application is audited and authorized through the open platform, and the authorization information is returned;

[0106] Step 2, call the jsbridge middleware, obtain the login-free code code through the jsbridge middleware, and obtain the access_token from the open platform based on the authorization information;

[0107] Step 3, based on the login-free code code and the access_token, obtain the user_id from the open platform, based on the user_id, the H5 application obtains the user information, the H5 application obtains the user information and accesses the APP system, calls the open platform and the jsbridge middleware, and realizes the business function based on the bridging method configured in the jsbridge middleware.

[0108] The registration information includes the application name, the application icon and the application address, the application name is the name of the H5 application to be accessed to the APP system, the application icon is the name of the H5 application to be accessed to the APP system, and the application address is the access address of the H5 application to be accessed to the APP system.

[0109] The jsbridge middleware is configured with a login-free password obtaining function, the H5 application calls the jsbridge middleware, calls the login-free password obtaining function in the jsbridge middleware, and obtains the login-free code code.

[0110] For the user inside the enterprise, the authorization information includes APP identifier APPID, APPKey, APP authorization code APPCord and APP secret APPSecret; the H5 application obtains access_token from the open platform with the above authorization information as the request parameter.

[0111] In this embodiment, for the user inside the enterprise, the access process is as follows:

[0112] S100, submit the registration information to the open platform;

[0113] S200, the open platform audits based on the registration information and returns the authorization information, which includes APP identifier APPID, APPKey, APP authorization code APPCord and APP secret APPSecret;

[0114] S300, the H5 application obtains access_token from the open platform with the above authorization information as the request parameter;

[0115] S400, the H5 application introduces jsbridge middleware and calls the password-free login code obtaining function in the jsbridge middleware to obtain the password-free login code code;

[0116] S500, the H5 application obtains user_id from the open platform based on the password-free login code code and access_token, and accesses the APP system based on the user_id;

[0117] S600, after access, the H5 application can perform single sign-on with the open platform, and call various methods in the open platform and jsbridge middleware to realize the functions required by the actual business.

[0118] For the user of the third-party enterprise, based on the registration information of the H5 application, the open platform audits and authorizes the H5 application, and returns the authorization information, including the following steps:

[0119] (1) submit the registration information and callback URL to the open platform;

[0120] (2) the open platform audits the registration information and returns the first authorization information to the H5 application, the first authorization information includes AppId, SuiteKey and signature key SuiteSecret, and returns the second authorization information to the H5 application through the callback URL, the second authorization information includes temporary authorization code AuthCode and authorized application enterprise AuthCorpId;

[0121] (3) After the audit is passed, the SuiteTicket is pushed to the H5 application through the callback URL in a timely manner until the H5 application returns the json data of the encrypted string "success" to the open platform.

[0122] The above first authorization information, second authorization information and SuiteTicket constitute the authorization information returned by the open platform.

[0123] For a user as a third-party enterprise, an access_token is obtained from the open platform based on the authorization information, including the following steps:

[0124] (1) Taking the timestamp + "\n" + suiteTicket as a signature string, taking the suiteSecret as a signature key, and using the algorithm HmacSHA256 to calculate a signature value signature;

[0125] (2) Taking the suiteTicket, timestamp and signature value signature as headers parameters, and taking the suiteKey and authCorpId as request parameters, an access_token is obtained from the open platform.

[0126] In this embodiment, for a user as a third-party enterprise, the access process is as follows:

[0127] S100, registration information and callback URL are submitted to the open platform;

[0128] S200, the open platform performs an audit based on the registration information, returns an AppId, a SuiteKey and a signature key SuiteSecret, and returns a temporary authorization code AuthCode and an AuthCorpId of an authorized application enterprise through the callback URL;

[0129] S300, after the audit, the open platform will push the SuiteTicket to the callback URL of the H5 application, and the H5 application will return the json data of the encrypted string "success" after receiving it, otherwise the open platform will continue to push the SuiteTicket;

[0130] S400, the H5 application takes the timestamp + "\n" + suiteTicket as a signature string, takes the suiteSecret as a signature key, and uses the algorithm HmacSHA256 to calculate a signature value signature;

[0131] S500, the H5 application acquires the access_token by taking the suiteTicket, the timestamp, and the signature value as the headers parameter and taking the suiteKey and the authCorpId as the request parameter;

[0132] S600, the H5 application exchanges the user_id from the open platform by using the code and the access_token, and thus the third-party enterprise application is connected.

[0133] S700, the H5 application can perform single sign-on with the open platform and call various methods in the open platform and the jsbridge middleware to realize the functions required by the actual business.

[0134] The data involved in the bridging method of the embodiment are transmitted by https encryption and the data interface parameters are encrypted, so that the communication is protected from being monitored and stolen by a third party. For the user as a third-party enterprise, the H5 application and the open platform are connected in the process of complying with the Oauth2.0 protocol, and the access token with timeliness is taken as a parameter for data acquisition, so that the privacy security is further ensured.

[0135] The method of the embodiment takes the jsbridge middleware as the basis for connecting the javascript and the native, the jsbridge middleware is configured with various bridging methods, the H5 application is audited and authorized by the open platform based on the registration information of the H5 application, the H5 application is connected to the APP system, the jsbridge middleware is configured with various bridging methods, and the open platform cooperates with the jsbridge middleware to realize the interaction between the native H5 application and the native advanced function.

[0136] Embodiment 2

[0137] The application access system based on the jsbridge includes the jsbridge middleware and the open platform, the jsbridge middleware is used to realize the business interaction based on the bridging method and is used to acquire the code by using the code acquisition function based on the bridging method and return the code to the H5 application, and the open platform includes a foreground interface and a background server, the foreground interface is used to interact with the administrator and the developer, the developer submits the registration information through the foreground interface, the H5 application is audited by the administrator based on the registration information through the foreground interface, and the authorization information is returned to the H5 application.

[0138] For the user as an individual, the background server is configured to return a token and a refreshToken to the H5 application based on the request parameters, the validity period of the refreshToken is longer than that of the token, when the token has exceeded the validity period but the refreshToken is within the validity period, the token is refreshed through the refreshToken, and after the refreshToken expires, the background server is configured to return the token and the refreshToken to the H5 application based on the submitted request parameters; the background server cooperates with the jsbridge middleware to implement a business function based on a bridging method configured in the jsbridge middleware.

[0139] For the user as an enterprise, the background server is configured to authorize the H5 application based on authorization information, and to return a user_id based on a submitted login-free code code and an access_token of the H5 application, so as to facilitate the H5 application to access the APP system, and the background server cooperates with the jsbridge middleware to implement a business function based on a bridging method configured in the jsbridge middleware.

[0140] In the embodiment, the data involved in the bridging method is transmitted in https encryption and the data interface parameters are encrypted; for the user as an individual, the H5 application complies with the Oauth2.0 protocol in the process of interfacing with the open platform.

[0141] The registration information includes an application name, an application icon, and an application address, the application name is the name of the H5 application to be accessed to the APP system, the application icon is the name of the H5 application to be accessed to the APP system, and the application address is the access address of the H5 application to be accessed to the APP system.

[0142] For the user as an individual, after the H5 application is audited through the front-end interface, the returned authorization information includes an AppId, an AppCode, and an AppSecret.

[0143] After the application address of the H5 application is spliced with the parameter code, signature is performed on the AppId, code and grantType to obtain a signature value as a request parameter, and the platform server is used to return a token and a refreshToken based on the request parameter; the expiration time of the token is short, and the validity period of the refreshToken is longer than that of the token; when the token has exceeded the validity period but the refreshToken is within the validity period, the refreshToken is used to refresh the token, and the operation is: grantType is replaced with refreshToken, signature is performed on the AppId, code and refreshToken to obtain a signature value as a request parameter, and the token and the refreshToken are obtained again from the open platform; after the refreshToken expires, signature is performed on the AppId, code and grantType to obtain a signature value as a request parameter, and the token and the refreshToken are obtained again from the open platform.

[0144] For the refreshToken, when the code is obtained, the interface for requesting the token is called, the parameter grantType is a way of obtaining the token, authorizationCode or refreshToken needs to be transmitted, if authorizationCode is transmitted, code is used for acquisition, if refreshToken is transmitted, refreshToken is used for acquisition; when the refreshToken is obtained for the first time, the code needs to be acquired, the token and the refreshToken are acquired, the expiration time of the token is short, the expiration time of the refreshToken is long, the so-called refreshing of the token is that when the token expires, the refreshToken is used to request the token again, and the code does not need to be used again.

[0145] The signature rule is as follows:

[0146] (1) The parameters key are sorted in the ASCII code table order;

[0147] (2) The signature string is spliced in the manner of key1=value1&key2=value2, wherein the null value and the sign field are removed;

[0148] (3) The hash of the signature string is obtained by using the sha256 algorithm;

[0149] (4) The private key provided by the APP system to the third-party application is used to sign the hash by RSA SSA-PKCS1-V1_5-SIGN;

[0150] (5) The authentication center verifies the signature using the application public key, and the private key is the appSecret obtained when the application is registered.

[0151] For users as an enterprise, the authorization information includes APP identification APPID, APPKey, APP authorization code APPCord and APP secret APPSecret; the H5 application takes the authorization information as a request parameter, and the background server is configured to return access_token to the H5 application based on the request parameter.

[0152] For users as a third-party enterprise, based on the submitted registration information and callback URL, the background server is configured to return first authorization information to the H5 application, the first authorization information includes AppId, SuiteKey and signature key SuiteSecret, and return second authorization information to the H5 application through the callback URL, the second authorization information includes temporary authorization code AuthCode and authorization open application enterprise AuthCorpId; after the audit is passed, SuiteTicket is pushed to the H5 application through the callback URL until the H5 application returns the encrypted string "success" to the open platform; and based on the headers parameter and request parameter submitted by the H5 application, the background server is configured to return access_token to the H5 application.

[0153] The headers parameter includes suiteTicket, timestamp and signature value signature, the request parameter includes suiteKey and authCorpId, and the signature value signature is calculated by taking timestamp+\n+suiteTicket as a signature string, taking suiteSecret as a signature key, and using algorithm HmacSHA256.

[0154] The system of the embodiment accesses the H5 application into the APP system through the application access method based on jsbridge disclosed in embodiment 1, and realizes the interaction between the H5 application and the native advanced function of the APP system based on the bridging method configured in the jsbridge middleware.

[0155] The application has been described in detail and illustrated above by the accompanying drawings and preferred embodiments, however the application is not limited to these disclosed embodiments, and based on the above described embodiments, those skilled in the art can know that the means in the different embodiments described above can be combined to obtain more embodiments of the application, and these embodiments are also within the protection scope of the application.

Claims

1. A jsbridge-based application access method, characterized in that The system is applied to a jsbridge middleware and an open platform, and a plurality of bridge methods are configured in the jsbridge middleware; For a user as an individual, the method comprises the following steps: Based on the registration information of the H5 application, the H5 application is audited by the open platform, and authorization information is returned; After the APP system opens the H5 application, it is judged whether the application address of the H5 application is spliced with a parameter code, if not, an authorization page is provided by the APP system, authorization of the user as an individual is obtained based on the authorization page, and the parameter code is spliced after the application address of the H5 application based on the authorization; If the application address of the H5 application is spliced with the parameter code, the request parameter is submitted to the open platform to obtain token and refreshToken, the validity period of refreshToken is longer than that of token, when token has exceeded the validity period but refreshToken is within the validity period, token is refreshed through refreshToken, after refreshToken expires, the request parameter is resubmitted to the open platform to obtain token and refreshToken; Based on token as a request parameter, user information is obtained, and the open platform and the jsbridge middleware are called, and the bridge method configured in the jsbridge middleware is used to realize the business function; For a user as an enterprise, the method comprises the following steps: Based on the registration information of the H5 application, the H5 application is audited by the open platform, and authorization information is returned; The jsbridge middleware is called, the login-free code code is obtained through the jsbridge middleware, and the access_token is obtained from the open platform based on the authorization information; Based on the login-free code code and the access_token, the user_id is obtained from the open platform, the user information is obtained based on the user_id, and the open platform and the jsbridge middleware are called, and the bridge method configured in the jsbridge middleware is used to realize the business function; The data involved in the bridge method is transmitted by https encryption and data interface parameter encryption; For a user as an individual, the H5 application and the open platform follow the Oauth2.0 protocol in the connection process; The registration information comprises: Application name, the application name is the name of the H5 application to be connected to the APP system; Application icon, the application icon is the name of the H5 application to be connected to the APP system; Application address, the application address is the access address of the H5 application to be connected to the APP system; The jsbridge middleware is called, the login-free code code is obtained through the jsbridge middleware, and comprises the following steps: The jsbridge middleware is introduced in the H5 application; The login-free code code is obtained by calling the login-free password acquisition function in the jsbridge middleware; Wherein, for the user as an individual, the authorization information returned after the H5 application is audited by the open platform includes AppId, AppCode and AppSecret; After the application address of the H5 application is spliced with the parameter code, the signature value obtained by signing the AppId, code and grantType is used as the request parameter to obtain the token and refreshToken from the open platform; When the token has exceeded the valid period, but the refreshToken is within the valid period, the refreshToken is used to refresh the token, and the operation is as follows: the grantType is replaced by refreshToken, the signature value obtained by signing the AppId, code and refreshToken is used as the request parameter, and the token and refreshToken are obtained from the open platform again; After the refreshToken expires, the signature value obtained by signing the AppId, code and grantType is used as the request parameter to obtain the token and refreshToken from the open platform again; Wherein, the signature rule is as follows: Sort the parameters key in ASCII code table order; Splice the signature string in the form of key1=value1&key2=value2, wherein the null value and the sign field are excluded; Hash the signature string by sha256 algorithm to obtain hash; Sign the hash by RSASSA-PKCS1-V1_5-SIGN based on the private key provided by the APP system to the third-party application; The authentication center verifies the signature using the application public key, and the private key is the appSecret obtained during the registration of the application; Wherein, for the user as an enterprise, the authorization information includes APP identification APPID, APPKey, APP authorization code APPCord and APP secret APPSecret; the H5 application obtains access_token from the open platform with the authorization information as the request parameter; For the user as a third-party enterprise, the H5 application is audited and authorized by the open platform based on the registration information of the H5 application, and the authorization information is returned, including the following steps: Submit the registration information and callback URL to the open platform; The open platform audits the registration information and returns the first authorization information to the H5 application, which includes AppId, SuiteKey and signature key SuiteSecret, and returns the second authorization information to the H5 application through the callback URL, which includes temporary authorization code AuthCode and AuthCorpId of the authorized application enterprise; After the audit, SuiteTicket is pushed to the H5 application through the callback URL until the H5 application returns the json data of the encrypted string "success" to the open platform; The first authorization information, the second authorization information and the SuiteTicket constitute authorization information returned by the open platform; For a user as a third-party enterprise, an access_token is obtained from the open platform based on the authorization information, including the following steps: Taking the timestamp timestamp+\n+suiteTicket as a signature string and taking suiteSecret as a signature key, a signature value signature is calculated using an algorithm HmacSHA256; Taking the suiteTicket, the timestamp timestamp and the signature value signature as headers parameters and taking suiteKey and authCorpId as request parameters, an access_token is obtained from the open platform.

2. The jsbridge-based application access system, characterized in that It comprises: The jsbridge middleware is used to implement business interaction based on a bridging method and is used to obtain a password-free login code code based on a password-free login code obtaining function and return the password-free login code code to an H5 application; The open platform comprises a foreground interface and a background server, the foreground interface is used to interact with administrators and developers, the developers submit registration information through the foreground interface, the H5 application is audited by the administrators based on the registration information through the foreground interface, and authorization information is returned to the H5 application; For a user as an individual, the background server is used to return a token and a refreshToken to the H5 application based on request parameters, the effective period of the refreshToken is longer than that of the token, when the token has exceeded the effective period but the refreshToken is within the effective period, the token is refreshed through the refreshToken, after the refreshToken expires, the background server is used to return the token and the refreshToken to the H5 application based on submitted request parameters; the background server cooperates with the jsbridge middleware and is used to implement a business function based on a bridging method configured in the jsbridge middleware; For a user as an enterprise, the background server is used to authorize the H5 application based on authorization information and is used to return a user_id based on a password-free login code code and an access_token submitted by the H5 application, so that the H5 application obtains user information, the background server cooperates with the jsbridge middleware and is used to implement a business function based on a bridging method configured in the jsbridge middleware; The system accesses the H5 application to the APP system and obtains user information based on the jsbridge-based application access method of claim 1, and implements interaction between the H5 application and the native advanced function of the APP system based on a bridging method configured in the jsbridge middleware; The data involved in the bridging method is transmitted in https encryption and data interface parameters are encrypted. For the user as an individual, the H5 application complies with the Oauth2.0 protocol in the process of docking with the open platform; The registration information includes: An application name, which is the name of the H5 application to be accessed to the APP system; An application icon, which is the name of the H5 application to be accessed to the APP system; An application address, which is the access address of the H5 application to be accessed to the APP system; For the user as an individual, the authorization information returned after the H5 application is audited through the foreground interface includes AppId, AppCode, and AppSecret; After the application address of the H5 application is concatenated with the parameter code, the signature value obtained by signing the AppId, code, and grantType is used as the request parameter, and the platform server returns token and refreshToken based on the request parameter; When the token has exceeded the valid period, but the refreshToken is within the valid period, the refreshToken is used to refresh the token, and the operation is as follows: the grantType is replaced with refreshToken, the signature value obtained by signing the AppId, code, and refreshToken is used as the request parameter, and the token and refreshToken are obtained from the open platform again; After the refreshToken expires, the signature value obtained by signing the AppId, code, and grantType is used as the request parameter, and the token and refreshToken are obtained from the open platform again; The signature rule is as follows: The parameters key are sorted in ASCII code table order; The signature string is concatenated in the manner of key1=value1&key2=value2, wherein the null value and the sign field are excluded; The hash of the signature string is obtained by using the sha256 algorithm; The hash is signed by using the private key provided by the APP system to the third-party application based on RSASSA-PKCS1-V1_5-SIGN; The authentication center verifies the signature by using the application public key, and the private key is the appSecret obtained during the registration of the application; For the user as an enterprise, the authorization information includes APP identification APPID, APPKey, APP authorization code APPCord, and APP secret APPSecret; The H5 application uses the authorization information as the request parameter, and the background server returns access_token to the H5 application based on the request parameter; For the user as a third-party enterprise, based on the submitted registration information and callback URL, the background server is configured to return first authorization information to the H5 application, the first authorization information including AppId, SuiteKey and signature key SuiteSecret, and return second authorization information to the H5 application through the callback URL, the second authorization information including temporary authorization code AuthCode and AuthCorpId of the authorized application enterprise; after the audit passes, configured to push SuiteTicket to the H5 application through the callback URL at regular intervals until the H5 application returns the json data of the encrypted string "success" to the open platform; and configured to return access_token to the H5 application based on the headers parameter and request parameter submitted by the H5 application; The headers parameter includes suiteTicket, timestamp and signature value signature, the request parameter includes suiteKey and authCorpId, and the signature value signature is calculated by taking timestamp + " \ n" + suiteTicket as a signature string and taking suiteSecret as a signature key through an algorithm HmacSHA256. ​

Citation Information

Patent Citations

  • Application interaction method and device, electronic equipment and readable storage medium

    CN109901827A

  • Login-free authorization method and system for third-party application

    CN112347437A

  • Node access authentication method and system supporting multi-protocol identifier analysis

    CN113542300A