Home  >  Article  >  WeChat Applet  >  How to implement snsapi_base, snsapi_userinfo and silent authorization in WeChat development

How to implement snsapi_base, snsapi_userinfo and silent authorization in WeChat development

高洛峰
高洛峰Original
2017-03-11 15:10:012773browse

This article mainly introduces relevant information on the implementation of snsapi_base, snsapi_userinfo and silent authorization in WeChat development. Friends in need can refer to

Detailed explanation of snsapi_base, snsapi_userinfo and silent authorization in WeChat development. The implementation

snsapi_base and snsapi_userinfo belong to the two scopes of WeChat webpage authorization to obtain user information

snsapi_base can only obtain access_token and openID

snsapi_userinfo can obtain more detailed user information, such as avatar, nickname, gender, etc.

First of all, the access_token here is different from the basic access_token (such as used in custom menus). The difference between the two is as follows:

The access_token authorized by the web page is updated together every time the openID is obtained, and the interface call frequency limit is "unlimited"

The basic access_token is generally limited to 2000 times/day, you need to save it yourself and update it regularly

Secondly, when the scope is snsapi_userinfo, according to the instructions in the official document, the user needs to click to authorize, but I found that there is a way Obtained silently without requiring click authorization. The method is as follows:

1. Through snsapi_base, obtain access_token and openid at the same time

2. Use the access_token and openid here for the http://www.php.cn/ interface

3. After the request is successful, the user details are obtained silently.

The premise of the above method is that users in the same public account follow it. If it is borrowed from another official account, the user needs to click to authorize it.

Thank you for reading, I hope it can help you, thank you for your support of this site!

The above is the detailed content of How to implement snsapi_base, snsapi_userinfo and silent authorization in WeChat development. For more information, please follow other related articles on the PHP Chinese website!

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