adamwynne / twitter-api

Async io interface to all the twitter APIs
372 stars 64 forks source link

App only auth #73

Open ioRekz opened 7 years ago

ioRekz commented 7 years ago

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

chbrown commented 7 years ago

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).

ioRekz commented 7 years ago

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 !

chbrown commented 7 years ago

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.)

ioRekz commented 7 years ago

You right ! I didn't even check as I was sure it was using the app only auth. Thanks, I don't think it's twitter api responsibility to improve those error msg either

On Fri, Feb 17, 2017 at 11:43 PM Christopher Brown notifications@github.com wrote:

You can't use app-only credentials on streaming endpoints. See the dev docs for Application-only authentication https://dev.twitter.com/oauth/application-only. And statuses/filter https://dev.twitter.com/streaming/reference/post/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.)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/adamwynne/twitter-api/issues/73#issuecomment-280786829, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqChpWqeYydvlDONpW-4HFjj3uyhLblks5rdiJ1gaJpZM4MEoH4 .