Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6088229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:57:41+00:00 2026-05-23T11:57:41+00:00

I am trying to create instance of AccessToken but its raising exception message. I

  • 0

I am trying to create instance of AccessToken but its raising exception message. I have two ways to generate the AccessToken. My workflow is that on android machine I authenticate the user using Oauth and then I get the accessKey, and accessSecret. I transfer those two strings to server using REST. I do following on server to get back AccessToken.

AccessToken token = new AccessToken(accessToken, accessSecret);

But above code is generating exeption that “java.lang.IllegalArgumentException: Invalid access token format.”
When I do the following:

twitter = new TwitterFactory().getInstance(); 
twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET); 
AccessToken aToken = twitter.getOAuthAccessToken(accessToken, accessSecret);

It gives following twitter exception:

The screen name / password combination seems to be invalid.Relevant discussions can be on the Internet at:……

Finally, I also used following code:

ConfigurationBuilder cb = new ConfigurationBuilder(); 
cb.setDebugEnabled(true) .setOAuthConsumerKey(twitterKey)
.setOAuthConsumerSecret(twitterSecret) 
.setOAuthAccessToken(twitter.getAccessToken())
.setOAuthAccessTokenSecret(twitter.getSecretToken()); 
TwitterFactory tf = new TwitterFactory(cb.build()); 
twitter4j.Twitter t4jTwitter = tf.getInstance();

It gives same invalid format exception.

So my question is that “is this a potential bug??” and Can I create AccessToken instance when I already have accessKey and accessSecret strings??

Thank you very much for the prompt reply.

Irfan Mirza

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:57:41+00:00Added an answer on May 23, 2026 at 11:57 am

    Are you sure accessToken and accessSecret contain OK values? It really could be caused by some omission that would make those empty or something.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a vector of custom items that I have created but
I am trying to create a reusable function that can open a single instance
I have COM object with few constructors, I'm trying to create new instance and
I'm trying to create a class TestClass that's divided over several files. I have
I am trying to create a instance of class but I keep on getting
I quickly ran into problems when trying to create an ActiveRecord instance that overrode
I am trying to create an instance of a the following class: #ifndef Sik_GameEntity_h
I'm trying to create an instance of a generic class using a Type object.
I'm trying to create an instance of my CompanyLogo model if the hash params[:vacancy]['companies']['company_logo']
I am trying to create a new instance of a class, however I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.