Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get twitter verify_credentials ? #37

Open
manish-2014 opened this issue Aug 14, 2014 · 2 comments
Open

How to get twitter verify_credentials ? #37

manish-2014 opened this issue Aug 14, 2014 · 2 comments

Comments

@manish-2014
Copy link

I used clj-oauth to successfully login to twitter and fetch access-token. However when I try to invoke twitter api for "https://api.twitter.com/1/account/verify_credentials.json", I am getting a 401.

I suspect the (http/get ... ) is not setting the credentials correctly.

  (defn handle-twitter-token-credentials  [oauth_token oauth_verifier]
     {:status 200
    :headers {"Content-Type" "text/html"}
    :body  (let [
             access-token-response (oauth/access-token consumer request-token oauth_verifier)
             _ (println " access-token-response: " access-token-response)

              req-credentials     (oauth/credentials consumer
                                (:oauth_token access-token-response)
                                (:oauth_token_secret access-token-response)
                                :GET
                                "https://api.twitter.com/1/account/verify_credentials.json"
                                )

              ; this is ok so far
             _ (println "credentials: " req-credentials) 
              ; this breaks at http/get with 401 . The req-credentials looks ok
              ; I think   http/get  is not setting the authorization headers correctly
             ;
             info (http/get "https://api.twitter.com/1/account/verify_credentials.json"
                            {:query-params req-credentials})

             _ (println "got info ")
             _ (println "class " (class info))
             _ (println (str into))

             ]
          (with-out-str "Ok")

        )} )
@drone29a
Copy link
Owner

Hello, thanks for the report. First, you should be using version 1.1 of the Twitter REST API. Please check if that works for you.

Are other authenticated Twitter REST API calls failing with a 401 as well?

@drone29a
Copy link
Owner

I should've tested a little more before commenting. The URL https://api.twitter.com/1/account/verify_credentials.json is for major version 1 and using 1.0 explicitly results in a different error.

Will take a closer look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants