微信 getAccessToken()獲取小程式的token
阿新 • • 發佈:2021-02-04
技術標籤:java
微信 getAccessToken() 獲取小程式的token
//獲取小程式token
public static String getAccessToken(){
//通過微信公眾號的AppId和AppSecret(當前ip地址必須在微信公眾號的白名單內)獲取微信公眾號的access_token(7200秒有效)
String str1 = sendGet("https://api.weixin.qq.com/cgi-bin/token","grant_type=XXXXX&appid=XXXX&secret=XXXXX" );
return str1;
}
其中 grant_type,appid,secret 由小程式生成。並且都為常量。