title: Twitter4j - Bad Authentication data. code - 215
body: <p>I am newbie with Twitter4J API. I am looking to validate my access, but I can't.</p>
  
  <pre><code>public class Buscador { 
  public static void main(String [] args) throws TwitterException{
  
      ConfigurationBuilder cb = new ConfigurationBuilder();
       cb.setDebugEnabled (true)
         .setOAuthConsumerKey ("********************")
         .setOAuthConsumerSecret ("********************")
         .setOAuthAccessToken ("********************")
         .setOAuthAccessTokenSecret ("********************");
  
      TwitterFactory tf = new TwitterFactory (cb.build ());
      Twitter twitter = tf.getInstance (); 
  
      Query query = new Query("avantis_bc");
      QueryResult result = twitter.search(query);
  
      do{
  
                List&lt;Status&gt; tweets = result.getTweets();
  
                for(Status tweet: tweets){
                     System.out.println("Usuário: "+tweet.getUser().getScreenName() + " Tweet: "+tweet.getText());
                }
  
                query = result.nextQuery();
  
                if(query!=null)
                     result = twitter.search(query);
      }while(query!=null);
  }   
  </code></pre>
  
  <p>}</p>
  
  <p>Exception in thread "main" 400:The request was invalid. An accompanying error message </p>
  
  <p>will explain why. This is the status code will be returned during version 1.0 rate </p>
  
  <p>limiting(<a href="https://dev.twitter.com/pages/rate-limiting" rel="nofollow">https://dev.twitter.com/pages/rate-limiting</a>). In API v1.1, a request without </p>
  
  <p>authentication is considered invalid and you will get this response.</p>
  
  <p>message - Bad Authentication data.</p>
  
  <p>code - 215</p>
  
  <p>Relevant discussions can be found on the Internet at:</p>
  
  <pre><code>http://www.google.co.jp/search?q=506c3b98 or
  
  http://www.google.co.jp/search?q=10b457b8
  </code></pre>
  
  <p>TwitterException{exceptionCode=[506c3b98-10b457b8], statusCode=400, message=Bad </p>
  
  <p>Authentication data., code=215, retryAfter=-1, rateLimitStatus=null, version=4.0.3}</p>
  
  <pre><code>at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:163)
  
  at twitter4j.HttpClientBase.request(HttpClientBase.java:53)
  
  at twitter4j.HttpClientBase.get(HttpClientBase.java:71)
  
  at twitter4j.TwitterImpl.get(TwitterImpl.java:1562)
  
  at twitter4j.TwitterImpl.search(TwitterImpl.java:253)
  
  at Buscador.main(Buscador.java:54)
  </code></pre>