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 8928659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:29:41+00:00 2026-06-15T08:29:41+00:00

(NB If you don’t understand clojure I can traslate the code in Java, just

  • 0

(NB If you don’t understand clojure I can traslate the code in Java, just ask please)

I am using scribe with clojure and I am finding some issue to log in with twitter, the code I am using:

(def twitter-service
  (-> (doto
          (ServiceBuilder.)
        (.provider (TwitterApi$Authenticate.))
        (.apiKey "apikey")
        (.apiSecret "apisecret")
        (.callback "https://morgan-siscia.rhcloud.com/tatata/"))
      (.build)))

(def tokens (atom {}))

(defn get-token []
  (.getRequestToken twitter-service))

(defn get-twitter-url [token]
  (swap! tokens assoc (.getToken token) token)
  (.getAuthorizationUrl twitter-service token))

(defn get-info-twitter [oauth-token oauth-veri]
  (let [token (get @tokens oauth-token)
        verifier (Verifier. oauth-veri)
        access-token (.getAccessToken twitter-service token verifier)
        request (doto (OAuthRequest. (Verb/POST)
                                     "https://api.twitter.com/oauth/access_token")
                  (.addOAuthParameter "oauth_token" oauth-token)
                  (.addBodyParameter "oauth_verifier" oauth-veri))]
    (do
      (.signRequest twitter-service access-token request)
      (swap! tokens dissoc oauth-token))
    (.getBody (.send request))))

The code is pretty a straight translation of the java code, however it is not working.

When I call (get-info-twitter “the-oauth-code” “the verifier code”) twitter return an error:

<?xml version="1.0" encoding="UTF-8"?>
<hash>
  <request>/oauth/access_token</request>
  <error>The access_token method must be called with a request_token</error>
</hash>

Honestly I have no idea what I am doing wrong, can somebody help me out ?

  • 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-06-15T08:29:42+00:00Added an answer on June 15, 2026 at 8:29 am

    Here is how Twitter OAuth works (I do it with Twitter4j, principle should be the same for you) :

    • you ask a RequestToken :

    RequestToken requestToken = twitter.getOAuthRequestToken();

    • From this, you get 2 objects : a token and a tokenSecret :

    String token = requestToken.getToken();
    String secretToken = requestToken.getTokenSecret();

    • User is authorizing your application and a callback URL is invoked by Twitter, passing you 2 parameters : oauth_token and oauth_verifier

    • With these 2 parameters, you can ask an AccessToken :

    AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, oauth_verifier);

    requestToken is rebuilt from previous token and secretToken saved somewhere

    • This new object contains 2 String you have to keep for future calls to Twitter :

    credentials.token = accessToken.getToken();

    credentials.secret = accessToken.getTokenSecret();

    I save this object in a database and reuse it for later calls to Twitter.
    I had the same error as you when I did not understand well all these tokens everywhere.

    Try to follow this step-by-step and it should work.

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

Sidebar

Related Questions

Don't be scared of the extensive code. The problem is general. I just provided
Don't be frightened, its a very basic code. Just wanted to check with you
Don't they both have to convert to machine code at some point to execute
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't understand this simple code: def main(): print (This program illustrates a chaotic function)
Don't ask me why but i can't use this method because I need to
Don't quite understand determinism in the context of concurrency and parallelism in Haskell. Some
Don't ask how I got there, but I was playing around with some masking,
Don't ask me how but I'm in a situation where I have DCPs published
don't know what happened in my jcrop selection. I think I pressed some keys

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.