Home > Mobile >  About WeChat development code for the public, has been successful
About WeChat development code for the public, has been successful

Time:10-14

1. Used in the development process is made of ngrok Intranet through
2. The access code of the code below

String appID="";
String appsecret="";
String redirect_uri="* * http://. Ngrok. Cc/project/yinda";
String code=null;
//access code url
String codeUrl="https://open.weixin.qq.com/connect/oauth2/authorize?"
+ "appid=" + appid
+ "& amp; Redirect_uri="+ redirect_uri
+ "& amp; The payload=code& The scope=snsapi_userinfo & amp; The state=123 # wechat_redirect ";
String access_tokenUrl="https://api.weixin.qq.com/sns/oauth2/access_token?"
+ "appid=" + appid
+ "& amp; Secret="+ appsecret
+ "& amp; Code="+ code
+ "& amp; Grant_type=authorization_code ";

Code=request. The getParameter (" code ");
System. The out. Println (code);
If (code==null | | "" equals (code)) {
The response. SendRedirect (codeUrl);
} else {
The response. SendRedirect (" http://www.baidu.com ");
}
}
# 3. The public test number entered WeChat public for the first time when the code is null, then execute the response. SendRedirect (codeUrl), after the code is not carried out, this is because the reason why I use ngrok or itself code where I write wrong, beg god to reassure

CodePudding user response:

The building Lord solved

CodePudding user response:

Solve it the building Lord, hope to get response. Thanks
  • Related