


WeChat public platform, WeChat web page authorization, redirect_uri parameter error, solution!
An error occurred when authorizing the WeChat webpage just now! ! ! WeChat webpage authorization redirect_uri parameter is wrong!
When you encounter a problem, the first thing you should do is check the technical documentation of the official WeChat public platform.
WeChat webpage authorization
If the user accesses a third-party webpage in the WeChat client, the official account can obtain the user's basic information through the WeChat webpage authorization mechanism to implement business logic.
Instructions on web page authorization callback domain name
1. Before WeChat official account requests user web page authorization, developers need to go to the configuration options of "Development - Interface Permission - Web Service - Web Account - Web Authorization to Obtain User Basic Information" on the official website of the public platform to modify the authorization callback. domain name. Please note that the domain name (which is a string) is filled in here, instead of the URL, so please do not add protocol headers such as http://;
2. The authorization callback domain name configuration specification is the full domain name. For example, the domain name that requires web page authorization is: www.qq.com. After configuration, the pages under this domain name are http://www.qq.com/music.html and http:/ /www.qq.com/login.html can perform OAuth2.0 authentication. But http://pay.qq.com, http://music.qq.com, http://qq.com cannot perform OAuth2.0 authentication
3. If the official account login authorization is given to a third-party developer for management, there is no need to make any settings. The third party can replace the official account to implement web page authorization.
Check the web services authorized by WeChat.
Web account Web page authorization to obtain user basic information No upper limit Modification
Click Modify, go in and change http://www.xxxx.cn to www.xxxx.cn and there will be no redirect_uri parameter error!
Note: http://www.xxxx.cn can be safely monitored through web page authorization. We didn’t know there was a problem. Later, when the program executed the call, we found that the redirect_uri parameter was wrong. After checking the document, we came back and found that it turned out to be The error here.
//Get the user’s openid
function getBaseInfo(){
//1. Get the code
$appid="qq1813284q1q6q8888";//The appid here is fake for demonstration purposes
$redirect_uri=urlencode("http:// www.xxxx.cn/xxx.php/Index/getUserOpenId");//The address here needs http://
$url="https://open.weixin.qq.com/connect/oauth2/authorize?appid =".$appid."&redirect_uri=".$redirect_uri."&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
header('location:'.$url);
}
function getUserOpenId(){
//2. Obtain the access_token authorized by the web page
$appid="qq1813284q1q6q8888";//The appid here is fake for demonstration
$appsecret="61qqqq36745987167q73bq1q2552 qq75";//The appsecret here is false For demonstration use
$code=$_GET['code'];
$url="https://api.weixin.qq.com/sns/oauth2/access_token?appid=".$appid."&secret=". $appsecret."&code=".$code."&grant_type=authorization_code ";
//3. Pull the user's openid
$res = $this->http_curl($url,'get');
var_dump($res);//Print to see the user’s openid
}
Another complaint, uploading pictures in the blog park is very troublesome. You need to upload them to the photo album first, and then fill in the URL address when inserting the picture. The screenshot inserted into the mobile phone will be huge, and you need to set the size separately. This user experience, I also drunk.
Did I do it incorrectly? Just used Blog Park for 2 days.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.