This commit is contained in:
dukun 2023-02-02 13:29:38 +08:00
parent fd4cb23156
commit 1f4ff3dbe9
1 changed files with 9 additions and 8 deletions

View File

@ -183,14 +183,15 @@ public class Ali {
private boolean refreshAccessToken() { private boolean refreshAccessToken() {
try { try {
JSONObject body = new JSONObject(); getQRCode();
String token = auth.getRefreshToken(); // JSONObject body = new JSONObject();
if (token.startsWith("http")) token = OkHttp.string(token).replaceAll("[^A-Za-z0-9]", ""); // String token = auth.getRefreshToken();
body.put("refresh_token", token); // if (token.startsWith("http")) token = OkHttp.string(token).replaceAll("[^A-Za-z0-9]", "");
body.put("grant_type", "refresh_token"); // body.put("refresh_token", token);
JSONObject object = new JSONObject(post("https://auth.aliyundrive.com/v2/account/token", body)); // body.put("grant_type", "refresh_token");
auth.setAccessToken(object.getString("token_type") + " " + object.getString("access_token")); // JSONObject object = new JSONObject(post("https://auth.aliyundrive.com/v2/account/token", body));
auth.setRefreshToken(object.getString("refresh_token")); // auth.setAccessToken(object.getString("token_type") + " " + object.getString("access_token"));
// auth.setRefreshToken(object.getString("refresh_token"));
return true; return true;
} catch (Exception e) { } catch (Exception e) {
checkService(); checkService();