adamwynne / twitter-api

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

Add application-only authentication option #60

Closed juxtin closed 9 years ago

juxtin commented 9 years ago

For many endpoints, it's possible to authenticate with just the application credentials and no user credentials at all. In this case, the application has its own separate rate limit (sometimes higher than the user-authenticated version), so it's possible to make at least twice as many requests per 15-minute period if one uses both the application-only and user-authenticated credentials. See Twitter's docs.

This commit extends make-oauth-creds with a new arity that takes two arguments: the app-key and app-secret, returning the application-only token. The get-request-args and oauth-header-string functions are similarly extended to properly handle the application-only auth map.

Finally, the is-200 macro is extended to take an optional :app-only arg, which causes the given function to be called with application-only credentials (see make-app-only-test-creds). I added additional tests using this macro where appropriate.

adamwynne commented 9 years ago

thanks for doing this

juxtin commented 9 years ago

No problem, thanks for the library! Do you have any plans to release a new version to Clojars soon?

adamwynne commented 9 years ago

I did today

On Wednesday, December 24, 2014, Justin Holguin notifications@github.com wrote:

No problem, thanks for the library! Do you have any plans to release a new version to Clojars soon?

— Reply to this email directly or view it on GitHub https://github.com/adamwynne/twitter-api/pull/60#issuecomment-68071190.