① 微信access token有效期多少秒
7200秒,2小時
② 怎麼判斷微信accesstoken是否過期
都會有 expires_in欄位,就是過期時間。
③ 如何取消app登錄時的微信授權綁定
很遺憾的告訴你,微信不能取消第三方授權。
因為第三方網站的登陸是有時間限制的哦,可能7天或者30天或者XX天就會自動取消了吧;具體我也沒用過,但是APP和游戲類的可以到 發現》游戲》右上角游戲管理吧,裡面就可以看到游戲和APP的授權。
」微信公眾平台開發者文檔「稱:refresh_token有效期的7天、30天、60天、90天,當refresh_token失效的後,需要用戶重新授權。
(3)微信refreshtoken有效期擴展閱讀:
第三方獲取你的信息包括:
openid 用戶的唯一標識
nickname 用戶昵稱
sex 用戶的性別,值為1時是男性,值為2時是女性,值為0時是未知
province 用戶個人資料填寫的省份
city 普通用戶個人資料填寫的城市
country 國家,如中國為CN
headimgurl 用戶頭像,最後一個數值代表正方形頭像大小(有0、46、64、96、132數值 可選,0代表640*640正方形頭像),用戶沒有頭像時該項為空。
若用戶更換 頭像,原有頭像URL將失效。
privilege 用戶特權信息,
json 數組,如微信沃卡用戶為(chinaunicom)
unionid 只有在用戶將公眾號綁定到微信開放平台帳號後,才會出現該欄位。
所以,我們最好不要隨便授權
④ 微信怎麼判斷微信accesstoken是否過期
獲取accesstoken的時候,正常都會有 expires_in欄位,就是過期時間,一般獲取到accesstoken後,如果是保存到memcache里,直接用expires_in 作為過期時間;如果保存到資料庫,則把當前時間加上7200,下次取accesstoken的時候先判斷當期時間是否大於資料庫里保存的時間,如果大於就表明過期了;
如果accesstoken時間未過期,但其他地方調用了accesstoken導致緩存里的過期了,則使用過期accesstoken後微信返回錯誤,這時候再重新向微信發起一次請求
{"access_token":"ACCESS_TOKEN",
"expires_in":7200,
"refresh_token":"REFRESH_TOKEN",
"openid":"OPENID",
"scope":"SCOPE"}
⑤ 微信中refresh_token中的API中的REFRESH_TOKEN是指以前的access_token嗎
他是隨機的一段字元串用來驗證鏈接。
⑥ android微信授權登陸後怎麼更新用戶狀態
的第三方登錄授權過後,獲取到了用戶的信息後,再去點擊 的登錄按鈕,不再跳轉 的登錄頁面了
⑦ 微信開發者token 有有效期嗎
沒有。但在公眾號里隨時可以重置token
⑧ ios 微信的openid有效期是多久
獲取微信OpenId 先獲取code 再通過code獲取authtoken,從authtoken中取出openid給前台 微信端一定不要忘記設定網頁賬號中的授權回調頁面域名 流程圖如下 主要代碼 頁面js代碼 /* 寫cookie */ function setCookie(name, value) { var Days = 30; var exp = new Date(); exp/connect/oauth2/authorize?appid=") /sns/oauth2/access_token?"; StringBuffer url = new StringBuffer(uri); url.URL; public class HttpClientUtil { // 設置body體 public static void setBodyParameter(String sb, HttpURLConnection conn) throws IOException { DataOutputStream out = new DataOutputStream(conn.getOutputStream()); out.writeBytes(sb); out.flush(); out.close(); } // 添加簽名header public static HttpURLConnection CreatePostHttpConnection(String uri) throws MalformedURLException, IOException, ProtocolException { URL url = new URL(uri); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setUseCaches(false); conn.setDoInput(true); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setInstanceFollowRedirects(true); conn.setConnectTimeout(30000); conn.setReadTimeout(30000); conn.setRequestProperty("Content-Type","application/json"); conn.setRequestProperty("Accept-Charset", "utf-8"); conn.setRequestProperty("contentType", "utf-8"); return conn; } public static byte[] readInputStream(InputStream inStream) throws Exception { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len = 0; while ((len = inStream.read(buffer)) != -1) { outStream.write(buffer, 0, len); } byte[] data = outStream.toByteArray(); outStream.close(); inStream.close(); return data; } } 封裝AuthToken的VO類 package com.huatek.shebao.wxpay; public class AuthToken { private String access_token; private Long expires_in; private String refresh_token; private String openid; private String scope; private String unionid; private Long errcode; private String errmsg; public String getAccess_token() { return access_token; } public void setAccess_token(String access_token) { this.access_token = access_token; } public Long getExpires_in() { return expires_in; } public void setExpires_in(Long expires_in) { this.expires_in = expires_in; } public String getRefresh_token() { return refresh_token; } public void setRefresh_token(String refresh_token) { this.refresh_token = refresh_token; } public String getOpenid() { return openid; } public void setOpenid(String openid) { this.openid = openid; } public String getScope() { return scope; } public void setScope(String scope) { this.scope = scope; } public String getUnionid() { return unionid; } public void setUnionid(String unionid) { this.unionid = unionid; } public Long getErrcode() { return errcode; } public void setErrcode(Long errcode) { this.errcode = errcode; } public String getErrmsg() { return errmsg; } public void setErrmsg(String errmsg) { this.errmsg = errmsg; } } 感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
⑨ php微信網頁授權refresh_token有效期問題
將refresh_token 存入cookie 中 設置 cookie有效期下次訪問可以直接從cookie 中取值。就不用重新點擊授權了。