[android-developers] Re: Twitter integration - AccessToken issue
This is what im doing to update a tweet. Twitter twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); twitter.setOAuthAccessToken(accessToken); twitter.updateStatus(Send from my app!); Everything seems fine apart from the AccessToken... On Jun 24, 12:54 pm, ram dharan rdhara...@gmail.com wrote: On Fri, Jun 24, 2011 at 5:16 PM, Albert albert8...@googlemail.com wrote: Hi all, I am using twitter4j library to integrate my app with Twitter. I am past the authorization request, callback and I have the token and tokenSecret back from the authentication. What's the problem? I am getting a java.lang.IllegalArgumentException: Invalid access token format error when I try to use these AccessToken accessToken = new AccessToken(token, tokenSecret); // throws exception Anyone else seen this? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en what do u want to do in the next step? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Twitter integration - AccessToken issue
AccessToken actoken=new AccessToken(CONSUMER_KEY, CONSUMER_SECRET); Twitter twitter=new TwitterFactory().getInstance(); twitter.setOAuthConsumer(ConstantsDemo.CONSUMER_KEY,ConstantsDemo.CONSUMER_SECRET); twitter.setOAuthAccessToken(actoken); try { twitter.updateStatus(msg); } catch (TwitterException e) { // TODO Auto-generated catch block e.printStackTrace(); This is what i did too,r u sending ConsumerKey and Consumer_Secret Properly On Fri, Jun 24, 2011 at 5:29 PM, Albert albert8...@googlemail.com wrote: This is what im doing to update a tweet. Twitter twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); twitter.setOAuthAccessToken(accessToken); twitter.updateStatus(Send from my app!); Everything seems fine apart from the AccessToken... On Jun 24, 12:54 pm, ram dharan rdhara...@gmail.com wrote: On Fri, Jun 24, 2011 at 5:16 PM, Albert albert8...@googlemail.com wrote: Hi all, I am using twitter4j library to integrate my app with Twitter. I am past the authorization request, callback and I have the token and tokenSecret back from the authentication. What's the problem? I am getting a java.lang.IllegalArgumentException: Invalid access token format error when I try to use these AccessToken accessToken = new AccessToken(token, tokenSecret); // throws exception Anyone else seen this? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en what do u want to do in the next step? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Twitter integration - AccessToken issue
ummm... this is what Im doing: commonHttpOAuthConsumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); //DefaultOAuthProvider authProvider = new CommonsHttpOAuthProvider(https:// api.twitter.com/oauth/request_token, https://api.twitter.com/oauth/access_token;, https:// api.twitter.com/oauth/authorize); authProvider.setOAuth10a(true); try { String oAuthURL = authProvider.retrieveRequestToken(commonHttpOAuthConsumer, CALLBACK_URL); persistProviderConsumer(); //here i save the provider and comsumer this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(oAuthURL))); } catch (OAuthMessageSignerException e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); e.printStackTrace(); } catch (OAuthNotAuthorizedException e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); e.printStackTrace(); } catch (OAuthExpectationFailedException e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); e.printStackTrace(); } catch (OAuthCommunicationException e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); e.printStackTrace(); } Then when the authorization is made on the web, it returns to my activity and i get the uri: String otoken = uri.getQueryParameter(OAuth.OAUTH_TOKEN); String verifier = uri.getQueryParameter(OAuth.OAUTH_VERIFIER); Log.d(TAG, verifier +verifier); Log.d(TAG, oToken +otoken); loadProviderConsumer(); //here i recover the provider and comsumer Log.d(TAG, comsumer oToken +commonHttpOAuthConsumer.getToken()); // this will populate token and token_secret in consumer try { authProvider.retrieveAccessToken(commonHttpOAuthConsumer, verifier); } catch (OAuthMessageSignerException e) { Log.d(TAG, OAuthMessageSignerException - ); e.printStackTrace(); } catch (OAuthNotAuthorizedException e) { Log.d(TAG, OAuthNotAuthorizedException - ); e.printStackTrace(); } catch (OAuthExpectationFailedException e) { Log.d(TAG, OAuthExpectationFailedException - ); e.printStackTrace(); } catch (OAuthCommunicationException e) { Log.d(TAG, OAuthCommunicationException - ); e.printStackTrace(); } String token = commonHttpOAuthConsumer.getToken(); String tokenSecret = commonHttpOAuthConsumer.getTokenSecret(); Log.d(TAG, token +token+ token secret +tokenSecret); saveToken(this, token); saveTokenSecret(this, tokenSecret); On Jun 24, 1:05 pm, ram dharan rdhara...@gmail.com wrote: AccessToken actoken=new AccessToken(CONSUMER_KEY, CONSUMER_SECRET); Twitter twitter=new TwitterFactory().getInstance(); twitter.setOAuthConsumer(ConstantsDemo.CONSUMER_KEY,ConstantsDemo.CONSUMER_ SECRET); twitter.setOAuthAccessToken(actoken); try { twitter.updateStatus(msg);} catch (TwitterException e) { // TODO Auto-generated catch block e.printStackTrace(); This is what i did too,r u sending ConsumerKey and Consumer_Secret Properly On Fri, Jun 24, 2011 at 5:29 PM, Albert albert8...@googlemail.com wrote: This is what im doing to update a tweet. Twitter twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); twitter.setOAuthAccessToken(accessToken); twitter.updateStatus(Send from my app!); Everything seems fine apart from the AccessToken... On Jun 24, 12:54 pm, ram dharan rdhara...@gmail.com wrote: On Fri, Jun 24, 2011 at 5:16 PM, Albert albert8...@googlemail.com wrote: Hi all, I am using twitter4j library to integrate my app with Twitter. I am past the authorization request, callback and I have the token and tokenSecret back from the authentication. What's the problem? I am getting