# Mini Program Server Component Usage Guide
# Introduction to Components
For details, please checkIntroduction to Mini Programs Server Components
# II. Component Access Process
# 1, registration of Mini programs
On WeChat Official PlatformRegistration Mini Program, fill in the information and submit the corresponding information according to the guidelines, complete the registration process, if there is a Mini Program, you can use it directly.
# 2, login WeChat open platform, bind Mini programs
log inWeChat Open Platform, select the Mini Program, click on the binding Mini Program, follow the instructions to complete the Mini Program binding.
# 3, login to the open platform, create a third-party platform
log inWeChat Open Platform, select Third Party Platform, click Create Third(Choose a platform provider.), complete the third-party platform creation according to the guidelines and enter the audit process. After approval, you can apply to open the Mini Program service provider component. If a third-party platform already exists, this step can be skipped.
# 4, login to the open platform, open the Mini Program service provider component
log inWeChat Open Platform, enter the third-party platform - details - ability application, select the Mini Program service provider component, and apply for opening functions.
Note: This component has been set not to be added through mp, only through the third party platform's ability to apply for addition.
# 5, the introduction of Mini Program service provider components, and the development of
The introduction of Mini Program service provider components in the Mini Program project can be accessed and developed with reference to the following documents. But it is recommended to look at the plugin itself'sOnline Development Documentation, to ensure access to the latest document update information.
# 6. Submission for Review and Release
After the completion of the development, submit the code to the WeChat team for review, and after the review is approved, it can be released.
# III. Use of components
# Reference to a component
Version Limitation: Base Library version 2.16.0 and above
APPID of component: wxb8b928431b8c56d8
3, need to introduce [Mini Program server component] in the project, edit the root directory of the project app.json File, the sample code is as follows:
"plugins": {
"miniprogram-thirdparty-plugin": {
"version": "2.xx.0",// The suggestion is the latest version number of the Mini Program service provider component, and the latest version number can be obtained when debugging WeChat developer tools (please remove the comments when copying)
"provider": "wxb8b928431b8c56d8" // Must fill in the Mini Program service provider component appid, do not modify (copy please remove comments)
}
}
# Component uses
# Using plugins in Mini Program code (trial Mini Program scenario)
const MiniprogramThirdpartyPlugin = requirePlugin('miniprogram-thirdparty-plugin')
// to initialize
MiniprogramThirdpartyPlugin.init(wx)
// Request User Authorization
MiniprogramThirdpartyPlugin.authorize({
token: 'createToken', // Create returned in the background_Token, authorized via [fastregisterbetaweapp] interface_Url, where the create_Token
success(res) {
// Authorization Success
wx.showToast({
title: "Successful Authorization,"
})
},
fail(err) {
console.error(err)
// Authorization failure or other exception
wx.showToast({
title: "failed authorization,"
})
}
})
// Request to open the trial Mini Program
MiniprogramThirdpartyPlugin.openTrial({
appid: 'appid', // Try the appid of the Mini Program
platformAppID: 'platform_appid', // Appid of the platform
fail() {
// Other anomalies
}
})
# Using plugins in Mini Program code (authorization scenario)
const MiniprogramThirdpartyPlugin = requirePlugin('miniprogram-thirdparty-plugin')
// to initialize
MiniprogramThirdpartyPlugin.init(wx)
// Request User Authorization
MiniprogramThirdpartyPlugin.openAuthorizeAccount({
platformAppID: '',
preAuthCode:,//Preauthorization code obtained
authType:3,
bizAppid: wxxxxxxxxx
})
Note: Please check the related parameter explainationAuthorization Process Technical Notes