예제 #1
0
 private static String SendToken() throws IOException {
   ServerConnector sc = new ServerConnector("user");
   HashMap<String, String> tokenMap = new HashMap<String, String>();
   tokenMap.put("access_token", access_token);
   tokenMap.put("expires_in", expires_in);
   sc.setRequestParam("userID", Login.userID);
   sc.setRequestParam("sinaToken", JSONHelper.getJSONHelperInstance().convertToString(tokenMap));
   String result = sc.doPost();
   return result;
 }
예제 #2
0
  public static boolean unBound() {

    if (isBound()) {

      ServerConnector sc = new ServerConnector("https://api.weibo.com/oauth2", "/revokeoauth2");
      sc.setRequestParam("access_token", access_token);
      try {
        String result = sc.doPost();
        Log.d("revoke", "result");
      } catch (IOException e) {
        // accessToken = null;
        Log.d("revoke exception", e.getMessage());
        e.printStackTrace();
      }

      AccountAPI accountAPI = new AccountAPI(accessToken);
      accountAPI.endSession(
          new RequestListener() {
            @Override
            public void onComplete(String s) {
              clearToken();
            }

            @Override
            public void onIOException(IOException e) {
              clearToken();
            }

            @Override
            public void onError(WeiboException e) {
              clearToken();
            }
          });
      clearToken();
    }

    clearToken();
    return true;
  }