@Override public void sendGetProfileRequest(BaseActivity activity, String authData) { // first step - get access token showWaitDialog(); PostTwitterData requestPairs = getRequestPostPairs(); String verifier = getURLQueryParameter(authData, "\\?", "oauth_verifier"); requestPairs.setOauth_verifier(verifier); requestPairs.setOauth_token(oauth_request_token); String signature = createRequestSignature( requestPairs, GET_TOKEN_URL, POST_REQUEST, oauth_request_token_secret); requestPairs.setOauth_signature(signature); sendAdditionalDataRequest(activity, GET_TOKEN_URL, requestPairs); }
@Override public void showAuthDialog(BaseActivity activity, AuthFinishListener listener) { this.activity = activity; this.listener = listener; oauth_request_token = null; oauth_request_token_secret = null; oauth_access_token = null; oauth_access_token_secret = null; // actually at this class showAuthDialog - only preparing to show auth dialog showWaitDialog(); PostTwitterData requestPairs = getRequestPostPairs(); requestPairs.setOauth_callback(REDIRECTED_URL); String signature = createRequestSignature(requestPairs, POST_REQUEST_TOKEN_URL, POST_REQUEST, ""); requestPairs.setOauth_signature(signature); sendAdditionalDataRequest(activity, POST_REQUEST_TOKEN_URL, requestPairs); }
@Override public void setAdditionalParameters(String params) { // TODO Auto-generated method stub hideWaitDialog(); if (oauth_request_token == null) { JSONObject obj; try { obj = new JSONObject(params); oauth_request_token_secret = obj.getString("oauth_token_secret"); oauth_request_token = obj.getString("oauth_token"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } // real show auth dialog super.showAuthDialog(activity, listener); } else if (oauth_access_token == null) { JSONObject obj; try { obj = new JSONObject(params); oauth_access_token_secret = obj.getString("oauth_token_secret"); oauth_access_token = obj.getString("oauth_token"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } // need to send get profile request PostTwitterData post = getRequestPostPairs(); post.setOauth_token(oauth_access_token); String signature = createRequestSignature(post, GET_PROFILE_URL, GET_REQUEST, oauth_access_token_secret); post.setOauth_signature(signature); super.sendGetProfileRequest( activity, new GsonBuilder().disableHtmlEscaping().create().toJson(post)); } }