wx.login mock
- Because in the Mini Program project is through the
wx.login
To be logged in, and the business is done through the Openid
As the unique id of the user's identity, however wx.login
in App Mode is not available, so in order to make it easy for developers to build Mini Programs as App After that, you can quickly experience the full App。 The developer tools providewx.login mockFunctions can be accessed through the mock To acquire non-real users. jscode
For testing. - That is, the developer can set thewx.login mock Function is turned on, and then built App Run in the
wx.login
Will return the non-real user's jscode
♪ if you don't open ♪ wx.login mock Function,wx.login
in App An error will be reported if called in the runtime environment.
Preconditio
- Developer Tools Version 1.06.2406142 (It is recommended to use the latestDevelopment versionDeveloper Tools)
- iOS >= 1.3.27
- Android >= 1.3.19
Operational steps
- Path: Toolbar - details - Local settings
- Note: Open/Stopwx.login mock Function, needs to be rebuilt to take effect
wx.login mock Conditions for success
- Mode is: Multiterminal Application ModeVersion is: Development Version
- The developer tools are open.wx.login mock function
- openwx.login mock Feature, there is the Rebuild Installation Package
- Developer tools need to be logged in, that is, if the developer tools login state is dropped, it will also causewx.login mock Invalid
- Mini Program and multi-terminal application to maintain a binding relationship, that is, if the Mini Program and multi-terminal application unbound, will also causewx.login mock Invalid
wx.login mock Effective priority
- When developers access multiple applicationsMini Program login service, i.e.
adaptWxLogin
Configured true
(Already configured to wx.login Automatically adapted to wx.getMiniProgramCode ), and at the same time openedwx.login mock Function,wx.login mock Features take effect with higher priority.
Common problem
1. How to confirm wx.login mock Success or failure
- The developer can vconsole Open the view log, success and failure references are as follows:
- If it fails, you can adjust the error message returned by the log
The translations are provided by WeChat Translation and are for reference only. In case of any inconsistency and discrepancy between the Chinese version and the English version, the Chinese version shall prevail.Incorrect translation. Tap to report.