문제

I'm using clj-oauth for a school project where I am creating a desktop client that reads from Twitter. I've been attempting to authenticate the client against Twitter and get the PIN so I can set it in the client and forget about it (since this is only for personal use and doesn't need to be distributed). It seems to me that after I request the token, I should be able to print the result from this:

(oauth/user-approval-uri consumer 
                         request-token)

And then use the URI printed to authenticate. However, whenever I try to paste that URI into my browser, Twitter gives me an error, saying that someone has already used the token I have provided. I have already correctly provided all the values to create a consumer and then obtain a request-token.

Is there an easy way to get my PIN using just the CLI and my browser?

도움이 되었습니까?

해결책

I ran across the same issue with this library. There is a minor bug in the user-approval-uri.

You can find the fix on my fork https://github.com/kurtharriger/clj-oauth.

The query string should have only included the oauth_token but was writing the entire map, for a quick one time fix you can probably just manually remove the extra bits from the query string when pasting in your browser.

다른 팁

I'm not positive, but I think you need to get an access-token after you get a request-token. Some of it is explained here.

"Pin based Twitter OAuth works just like the original (web) OAuth (request tokens, access tokens) but instead of returning back to a web page, Twitter gives out a Pin code that you have to input into your app in order to exchange its request token with an access token."

Hopefully this helps!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top