search
Homephp教程php手册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!

微信网页授权redirect_uri 参数错误

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.

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Article

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF

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),

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment