adamwynne/twitter-api

App only auth

Opened this issue · 4 comments

Hello,

I don't understand what should I put in my creds map to make it auth with the bearer token for an app_only auth.

Thanks

You would do something like:

(restful/application-rate-limit-status :oauth-creds (make-oauth-creds app-key app-secret))

When called with only two arguments, make-oauth-creds returns an app-only credentials map.


I'm in the middle of revamping the authentication mechanism, since the latest versions of clj-oauth and http.async.client make a lot of the auth code built into twitter-api redundant; I'll close this issue when I push that but it'll be the same API for you (the end user).

Thanks for the fast response,

That's actually what I'm doing using the stream api
(statuses-filter :params {:track "hi"} :oauth-creds my-creds :callbacks *custom-streaming-callback*))

where my-creds is (make-oauth-creds key secret) which are valid

I have an Unauthorized error from the api though. I have another app using the same creds so they must be valid !

You can't use app-only credentials on streaming endpoints. See the dev docs for Application-only authentication. And statuses/filter in particular.

I have another app using the same creds so they must be valid !

I believe you, but I suspect you aren't streaming in this other app :)

Twitter's error message could be more descriptive, though it is correct — app-only credentials are "Unauthorized" to use the streaming API. (I don't think it's twitter-api's responsibility to improve those error messages, though — at least, not as high priority as many other issues.)