Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Patch to allow some actions to work without auth #6

Closed
wants to merge 1 commit into from

2 participants

Leif Gruenwoldt Greg Kroah-Hartman
Leif Gruenwoldt

Hey Greg, I was looking for a simple way to grep a users twitter history when I ran across your bti client in the Fedora repos. The fun oauth hurdles prompted me to take a crack at making bti more friendly for performing actions like viewing public tweets that do not require authentication in the first place. The 'user' and 'public' actions should now work without authentication. However if twitter authentication is defined then bti will use that because some twitter user accounts make their tweets private.

Greg Kroah-Hartman
Owner

Now pulled into the main bti tree, thanks so much for the patch.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 4, 2011
  1. Leif Gruenwoldt
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 7 deletions.
  1. +14 −7 bti.c
21 bti.c
View
@@ -98,6 +98,7 @@ struct session {
int dry_run;
int page;
int no_oauth;
+ int guest;
enum host host;
enum action action;
void *readline_handle;
@@ -592,7 +593,7 @@ static int send_request(struct session *session)
if (!session->hosturl)
session->hosturl = strdup(twitter_host);
- if (session->no_oauth) {
+ if (session->no_oauth || session->guest) {
curl_buf = bti_curl_buffer_alloc(session->action);
if (!curl_buf)
return -ENOMEM;
@@ -1544,11 +1545,17 @@ int main(int argc, char *argv[], char *envp[])
if (session->host == HOST_TWITTER) {
if (!session->consumer_key || !session->consumer_secret) {
- fprintf(stderr,
- "Twitter no longer supports HTTP basic authentication.\n"
- "Both consumer key, and consumer secret are required"
- " for bti in order to behave as an OAuth consumer.\n");
- goto exit;
+ if (session->action == ACTION_USER ||
+ session->action == ACTION_PUBLIC) {
+ /* Some actions may still work without authentication */
+ session->guest = 1;
+ } else {
+ fprintf(stderr,
+ "Twitter no longer supports HTTP basic authentication.\n"
+ "Both consumer key, and consumer secret are required"
+ " for bti in order to behave as an OAuth consumer.\n");
+ goto exit;
+ }
}
if (session->action == ACTION_GROUP) {
fprintf(stderr, "Groups only work in Identi.ca.\n");
@@ -1570,7 +1577,7 @@ int main(int argc, char *argv[], char *envp[])
session->hostname);
session->password = strdup(password);
}
- } else {
+ } else if (!session->guest) {
if (!session->access_token_key ||
!session->access_token_secret) {
request_access_token(session);
Something went wrong with that request. Please try again.