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

App only auth #73

Open
ioRekz opened this issue Feb 17, 2017 · 4 comments
Open

App only auth #73

ioRekz opened this issue Feb 17, 2017 · 4 comments

Comments

@ioRekz
Copy link

ioRekz commented Feb 17, 2017

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
Copy link
Collaborator

chbrown commented Feb 17, 2017

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
Copy link
Author

ioRekz commented Feb 17, 2017

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
Copy link
Collaborator

chbrown commented Feb 17, 2017

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
Copy link
Author

ioRekz commented Feb 17, 2017 via email

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