In this paper, we describe the method of public platform to obtain user OpenID. Share to everyone for your reference. The specific analysis is as follows:
After the user clicks on the Custom menu view Type button, the client will open the URL value (ie link) that the developer fills in the button to reach the Web page, but the view cannot get the user's OpenID, and it needs to use the advanced interface of "Web license Access user basic information", Get the user's login personal information.
Specific methods:
1, configure the page authorization callback domain name, such as Www.bitsCN.com
2. Third party Web page of The Sims, http://www.bitsCN.com/getcodeurl.php
<?php if (isset ($_session[' user ')) { Print_r ($_session[' user '); exit;} $APPID = ' APPID of the public number '; $REDIRECT _uri= ' http://www.bitsCN.com/callback.php '; $scope = ' snsapi_base ';//$scope = ' Snsapi_ UserInfo ';//need to authorize $url= ' https://open.weixin.qq.com/connect/oauth2/authorize?appid= '. $APPID. ' &redirect_uri= '. UrlEncode ($REDIRECT _uri). ' &response_type=code&scope= '. $scope. ' &state= '. $state. ' #wechat_redirect '; header ("Location:". $url);? >
3, the Third party Web page bounce URL, first get code from the request, and then according to code further in exchange for OpenID and Access_token, and then can be based on the OpenID and Access_token invoke the relevant interface to query user information.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.