Website call qq Sign in

1. Preparations

(1) before the access log QQ, the application site must firstly obtain a corresponding appid AppKey and, in order to guarantee the correct site and subsequent user authentication and authorization processes.

① QQ Internet Developer account registration URL   https://connect.qq.com/

② Click the picture to enter the basic information to fill the head office for review after fill in the information.

③ the audit by the addition of web applications, the application can be viewed through the audit to appid and appkey.

2. authorization process, step

oauth2.0_guid_1.png

3. Specific steps QQ Internet documents in great detail, can be developed according to the document provided by QQ

(1) QQ login button placed on the website, you can customize, click to jump on the line, php generates an address onto the buttons or js document has a direct jump can be used directly, but I am not like him api , can not read, did not know he had some connection relationship.

(2) obtain user authorization get AccessToken.

(3) use AccessToken get the user openid.

(4) using openid obtain user information.

(5) openid the user and the user information stored in the database can be, openid unique.

4. The code implementation

(1) QQ official SDK, you can download

① After downloading the installation file can be accessed directly, the installation of appid and appkey fill, to fill in the callback address (fill in the corresponding address on the Internet QQ), have to check the permissions (must be filled in this appid owned and appkey authority, or will be error, the error is reported callback address error).

Access address debugging ② after installation.

(2) to write, micro-contrast letter document, essentially similar, not explained in detail here.

(3) the use of official documents calling php achieve some places may be a problem, the problem is not considered an error.

① general logic flow required

 

② Click the output destined for QQ login address

 

③ obtain user information

 

5. Summary

(1) and finishing processes as micro-letters, simple

① create Internet applications QQ

② use appid and appkey get accessToken, openid

③ using the obtained user information openid

④ the user information stored in the database.

Guess you like

Origin www.cnblogs.com/zhouxiaohei/p/12083714.html
qq