Similarities and differences between web authorization access_token and basic support access_token in WeChat development

Similarities and differences between web authorization access_token and basic support access_token in WeChat development

Question 1: Is the webpage authorized access_token the same as the access_token in the shared jssdk?

Answer: Not the same. Web page authorization access_token is one-time, while the basic support access_token has a time limit: 7200s.

Question 2: The webpage authorization access_token is different from the basic supported access_token. Is the access_token in WeChat sharing the basic supported access_token?

Answer: yes

Webpage authorization access_token can only obtain the information of one WeChat user, which is a one-to-one relationship with WeChat users.

The basic support of access_token can use access_token and openId to obtain WeChat user information within the validity period.

Question 3: Is there a limit on the number of times the webpage authorizes access_token?

Answer: There is no limit

Question 4: Obtain basic user information through web page authorization, and use the access_token in jssdk to obtain user data. What is the situation?

Answer: Isn’t the access_token authorized on the data-checking webpage different from the access_token in the shared jssdk? This needs to be verified again.

Question 5: Regarding the limit on the number of times access_token can be obtained?

answer:

Interface daily limit

Get access_token 2000

Custom menu creation 1000

Custom menu query 10000

Get user basic information 5000000

Get webpage authorization access_token none

Refresh webpage authorization access_token none

Webpage authorization to obtain user information

Question 6: How many ways are there to obtain openid for WeChat developers?

Answer: There are two ways, both are passive.

1. Jump through url, Tencent's sns social login, and get openid.

such as:

//Get openid
$oauth2Url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$secret&code=$code&grant_type=authorization_code";
$oauth2 = getJson($oauth2Url);
$openid = $oauth2['openid'];

2. Send messages through users and get openid through fromuser

Refer to the official answer:

Web page authorization interface call credentials, note: this access_token is different from the basic supported access_token

About the difference between webpage authorization access_token and ordinary access_token

1. WeChat webpage authorization is implemented through the OAuth2.0 mechanism. After the user authorizes the official account, the official account can obtain a unique webpage authorization interface call certificate (webpage authorization access_token), and the post-authorization interface can be performed through the webpage authorization access_token Call, such as obtaining basic user information;

2. For other WeChat interfaces, ordinary access_token calls must be obtained through the "Get access_token" interface in the basic support.

Reference: https://cloud.tencent.com/developer/article/1056117 The similarities and differences between the web authorization access_token and the basic supported access_token in the development of WeChat-Cloud + Community-Tencent Cloud