Senparc.Weixin.MP微信开发——(1)token获取
/// <summary>
/// access_token是公众号的全局唯一票据,公众号调用各接口时都需使用access_token。开发者需要进行妥善保存。access_token的存储至少要保留512个字符空间。
///access_token的有效期目前为2个小时(7200秒),需定时刷新,重复获取将导致上次获取的access_token失效。
/// 每日限额获取access_token.
var result = Senparc.Weixin.MP.CommonAPIs.CommonApi.GetToken(appid, appsecret);
access_token = result.access_token;
微信开发者文档
(https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET)
| 参数 | 是否必须 | 说明 |
|---|---|---|
| grant_type | 是 | 获取access_token填写client_credential |
| appid | 是 | 第三方用户唯一凭证 |
| secret | 是 | 第三方用户唯一凭证密钥,即appsecret |

浙公网安备 33010602011771号