和通讯录 v3.9.6版本的 MD5 值为:669178e2ee1b2311daf378bd20c6bbe1
以下内容为反编译后的 AccessTokenController.java 源代码,内容仅作参考
package com.chinamobile.contacts.im.mobilecard.controller;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.chinamobile.contacts.im.App;
import com.chinamobile.contacts.im.config.LoginInfoSP;
import com.chinamobile.contacts.im.data.ContactAccessor;
import com.chinamobile.contacts.im.mobilecard.HttpsClientManager;
import com.chinamobile.contacts.im.mobilecard.OneCardLoginController;
import com.chinamobile.contacts.im.mobilecard.SignatureUtil;
import com.chinamobile.contacts.im.utils.aq;
import com.huawei.mcs.cloud.msg.base.mms.Telephony;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;
public class AccessTokenController {
public Context mContext;
public AccessTokenController(Context context) {
this.mContext = context;
}
public boolean getAccessToken() {
boolean z;
try {
HashMap hashMap = new HashMap();
String randomString = OneCardLoginController.getRandomString(12);
String l = ContactAccessor.getAuth(this.mContext).l();
HashMap hashMap2 = new HashMap();
hashMap2.put("app_key", OneCardLoginController.APP_KEY);
hashMap2.put("once", randomString);
hashMap2.put("version", OneCardLoginController.API_VERSION);
hashMap2.put("sdk_from", "java");
hashMap2.put("ssoToken", l);
String signature = SignatureUtil.getSignature(hashMap2);
hashMap.put("app_key", OneCardLoginController.APP_KEY);
hashMap.put("once", randomString);
hashMap.put("version", OneCardLoginController.API_VERSION);
hashMap.put("sdk_from", "java");
hashMap.put("ssoToken", l);
hashMap.put("signature", signature);
String doHttpsPost = HttpsClientManager.doHttpsPost("https://api.cytxl.com.cn/auth/getToken.json", hashMap);
if (TextUtils.isEmpty(doHttpsPost)) {
z = false;
} else {
aq.d("OneCardLoginController", "getAccessToken---" + doHttpsPost);
JSONObject jSONObject = new JSONObject(doHttpsPost);
if (jSONObject.optInt(Telephony.TextBasedSmsColumns.ERROR_CODE, -1) == 0) {
z = true;
} else {
String optString = jSONObject.optString("error_msg", "");
if (!TextUtils.isEmpty(optString)) {
Log.e("OneCardLoginController", optString);
}
z = false;
}
JSONObject optJSONObject = jSONObject.optJSONObject("data");
if (optJSONObject != null) {
String optString2 = optJSONObject.optString("access_token", "");
if (!TextUtils.isEmpty(optString2)) {
LoginInfoSP.saveAccessToken(this.mContext, optString2);
}
String optString3 = optJSONObject.optString("access_secret", "");
if (!TextUtils.isEmpty(optString3)) {
LoginInfoSP.saveAccessSecret(this.mContext, optString3);
}
optJSONObject.optInt("access_token", -1);
}
}
return z;
} catch (JSONException e) {
e.printStackTrace();
return false;
} catch (Exception e2) {
e2.printStackTrace();
return false;
}
}
public void ProblemToGetAccessToken(int i) {
if ((i == 9009003 || i == 9009004 || i == 102) && new AccessTokenController(App.b()).getAccessToken() && UserAutoregisterController.getAccessToken()) {
UserLoginController.getUserLoginController();
}
}
}