title: Error processing your OAuth request: Invalid oauth_verifier parameter
body: <p>I'm following <a href="https://dev.twitter.com/web/sign-in/implementing" rel="nofollow">https://dev.twitter.com/web/sign-in/implementing</a> to implement OAuth signup in my application with twitter.</p>
  
  <p>Here is the service which presents the User the authorize this app dialog from twitter:</p>
  
  <pre><code>@GET
  @Produces(MediaType.APPLICATION_JSON)
  @Path("/twitter")
  public Response redirectToTwitter() {
      Configuration cfg = new ConfigurationBuilder().setOAuthConsumerKey(TWITTER_CONSUMER_KEY)
                                                    .setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET)
                                                    .build();
      Twitter twitter = new TwitterFactory(cfg).getInstance();
      String callbackURL = "https://localhost:9090/app/ui/oauth/twitter";
      try {
          RequestToken requestToken = twitter.getOAuthRequestToken(callbackURL);
          String authURL = requestToken.getAuthenticationURL();
          return Response.seeOther(URI.create(authURL)).build();
      } catch (TwitterException e) {
          LOG.error(e.getMessage(), e);
          return ErrorResponse.create(e.getMessage());
      }
  }
  </code></pre>
  
  <p>This works and redirects the browser to the Twitter Page which asks for authorization. When I click Sign In the redirect dialog appears which redirect me to a URL something like:</p>
  
  <p><a href="https://localhost:9090/app/ui/oauth/twitter?oauth_token=6oWQxQAAAAAAgyORAAABTtmVVFM&amp;oauth_verifier=GMX5SiqnkFfUu2MgirTDJnkJmtHZXn5H" rel="nofollow">https://localhost:9090/app/ui/oauth/twitter?oauth_token=6oWQxQAAAAAAgyORAAABTtmVVFM&amp;oauth_verifier=GMX5SiqnkFfUu2MgirTDJnkJmtHZXn5H</a></p>
  
  <pre><code>@GET
  @Path("/twitter")
  public SocialSignInView login(@QueryParam("oauth_token") String token,
                                @QueryParam("oauth_verifier") String verifier) {
      Configuration cfg = new ConfigurationBuilder().setOAuthConsumerKey(TWITTER_CONSUMER_KEY)
              .setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET)
              .setOAuthAccessToken(token)
              .build();
      Twitter twitter = new TwitterFactory(cfg).getInstance();
      String callbackURL = "https://localhost:9090/app/ui/oauth/twitter";
      String screenName = null;
      try {
          RequestToken requestToken = twitter.getOAuthRequestToken(callbackURL);
          AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, verifier);
          screenName = accessToken.getScreenName();
      } catch (TwitterException e) {
          LOG.error(e.getMessage(), e);
      }
  
      return new SocialSignInView(screenName);
  }
  </code></pre>
  
  <p>At this point I have all the required parameters - according to <a href="https://dev.twitter.com/web/sign-in/implementing" rel="nofollow">https://dev.twitter.com/web/sign-in/implementing</a> 3. - to retrieve an access token, however, I don't know how to put together a RequestToken object form the existing <code>oauth_token</code>.</p>
  
  <p>With the code above I'm receiving the following error:</p>
  
  <pre><code>ERROR 13:33:06.478 [dw-165 - GET /app/ui/oauth/twitter?oauth_token=6oWQxQAAAAAAgyORAAABTtmVVFM&amp;oauth_verifier=GMX5SiqnkFfUu2MgirTDJnkJmtHZXn5H] r.d.d.resources.SocialSignInCompleteResource: 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.
  Error processing your OAuth request: Invalid oauth_verifier parameter
  </code></pre>