Home  >  Article  >  Web Front-end  >  How to solve the uniapp login error prompt problem

How to solve the uniapp login error prompt problem

藏色散人
藏色散人Original
2021-01-26 11:49:249789browse

Solutions to uniapp login error prompts: 1. Modify the appid appsecret in the configuration file; 2. Set the package name of the WeChat open platform to be the same as when packaging; 3. Use the signature acquisition tool provided by WeChat to obtain the signature; 4. , Reinstall WeChat and test again.

How to solve the uniapp login error prompt problem

The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, Dell G3 computer.

Recommendation (free): uni-app tutorial

Specific question:

WeChat login prompt login failed

After packaging, the WeChat login prompts that the login failed. The authorization page can be jumped. After the user clicks to confirm the authorization, he returns to the APP and directly prompts that the login failed. There is no success or failure. The following is the code, signature and The registration is correct, and there are no problems with appid and appsecret

uni.login({  
            provider: 'weixin',  
            success: (res) => {  
                     uni.showToast({  
                            title: '登陆成功'  
                        });  
                    },  
                    fail: (res) => {  
                        /* uni.showModal({  
                            title: '登陆失败',  
                            content: encodeURIComponent(JSON.stringify(res)),  
                        }) */  
                        uni.showToast({  
                            title: '登陆失败123',  
                            icon: 'none'  
                        })  
                    }  
                })

Solution:

Every developer needs to pay attention

Configuration file modification appid appsecret

The package name of WeChat Open Platform must be the same as when packaging.

The signature of WeChat Open Platform is generally 59201cf6589202cb2cdab26752472112. You need to obtain the specific information by yourself. Use the signature acquisition tool provided by WeChat to obtain the specific information. See https://blog.csdn.net/m00123456789/article/details/56481656

The WeChat cache problem is also a headache. After the test fails, you need to reinstall WeChat and test again, because WeChat will cache your appid. and appsecret, causing errors to occur every time you test

The above is the detailed content of How to solve the uniapp login error prompt problem. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Can uniapp use vant?Next article:Can uniapp use vant?