# Configure identity management services
- To make it easier for developers to accessMultiterminal identity managementServices, developer tools support one-click accessMultiterminal Identity Management ServicesThe required configuration is as follows.
# Add Mini Program Authorization Page
- The Multiterminal Identity Management Service supports the use ofMini Program login, its flow for the user to click on the Mini Program login, will jump to the Mini Program bound by the multi-terminal application module, after obtaining the Mini Program authorization can return to the multi-terminal application, and the developer can obtain the Mini Program jscode information
- Therefore, you need to insert in the Mini ProgramSmall Program Authorization Page, The Page The addition logic of the app.json to hit the target useAuthorizePage Control, i.e.
// app.json
{
"miniApp": {
"useAuthorizePage": true // true Indicates that it will authorize Page Inserted into the Mini Programfalse Indicates that it will not authorize Page Inserted into the Mini Program
}
}
- In addition, it is necessary to app.miniapp.json In Configuration identityServiceConfig Information, as follows
// app.miniapp.json
{
"identityServiceConfig": {
"authorizeMiniprogramType": 1, // You can specify the version of the jump Mini Program (0: official version, 1: development version, 2: experience version)
}
}
- authorizeMiniprogramType Controls the version of the Mini Program to be invoked at login (Note: When testing, it is recommended to configure 1, after the Mini Program is officially online, it is configured to 0)
# Add Mini Program Login Page
- To further reduce the cost of developing a multi-terminal application login page, Developer Tools also provides a template for a Mini Program login page to quickly launch testsDevelopers can customize this login page
- After you modify the login page for your custom Mini Program, you need to identityServiceConfig modify miniprogramLoginPath
- By default, the Developer Tools configured miniprogramLoginPath for default , if the developer needs to modify the login Page, which can be modified by referring to the below
// app.miniapp.json
{
"identityServiceConfig": {
"miniprogramLoginPath": "/pages/donutLogin /donutLogin // This field will control the call to the wx.getMiniProgramCode If the login state fails, the login page will appear by default
}
}
# will wx.login Adapted to wx.getMiniProgramCode
- Upon completion of the above operation, the developer is free to place wx.login Replaced by Wx.getminiprogramcode, but considering that this code needs to be also the code of the Mini Program, and in the Mini Program still needs to call Wx.login, developers need to use conditional compiled syntax for compatibility
- To further reduce the developer's handling of compatible logic here, apageminiapagejson newly added adaptWxLogin Parameter is used to control whether in multiterminal application mode the wx.login Adapted to wx.getMiniProgramCode
"adaptWxLogin": true
// app.miniapp.json
{
"identityServiceConfig": {
"adaptWxLogin": true
}
}
That is, after the developer tools perform a one-click configuration for identity login services, apageminiapagejson and app.json Add the following:
// app.miniapp.json
{
"identityServiceConfig":
{
"authorizeMiniprogramType": 1, // Specify the version of the jump Mini Program (0: official version, 1: development version, 2: experience version)
"miniprogramLoginPath": "__default__", // If you have custom requirements, you can fill out the business selected Page Route
"adaptWxLogin": true
}
}
// app.json
{
"miniApp": {
"useAuthorizePage": true
}
}