Php authorization example on WeChat OAuth2.0 webpage

Source: Internet
Author: User
Tags openid php example
Example 1. configure the domain name of the authorization callback page, such as www.aaa.com? 2. a third-party webpage simulating a public account, fn_system.php & lt ;? Phpif (empty ($ _ SESSION ['user']) {header (OAuth2.0 web page authorization php example

1. configure the authorization callback page domain name, such as www.aaa.com

?

2. a third-party webpage simulating a public account, fn_system.php

 

?

3. when accessing a third-party webpage, if the session information does not exist in the session, go to the login page, fn_wx_login.php

 

?

4. on the login page, assemble the appid, jump back url, and other information, and then jump to the user authorization page.

?

5. on the user authorization page, if you select "agree to authorize", The code parameter is included when you jump back to the redirection address of a third-party webpage.

?

6. in the redirection url of a third-party webpage, first obtain the code from the request, and then exchange openid and access_token based on the code, then, you can query User information based on the APIs called by openid and access_token.

 

?

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.