- Timestamp:
- 2010-04-26T21:20:09Z (15 years ago)
- Branches:
- master
- Children:
- 713d611
- Parents:
- 508c340
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/oauth.c
r508c340 racba168 31 31 #include "sha1.h" 32 32 #include "url.h" 33 #include "oauth.h" 33 34 34 35 #define CONSUMER_KEY "xsDNKJuNZYkZyMcu914uEA" … … 37 38 38 39 #define HMAC_BLOCK_SIZE 64 39 40 struct oauth_info;41 typedef void (*oauth_cb)( struct oauth_info * );42 43 struct oauth_info44 {45 oauth_cb func;46 void *data;47 48 struct http_request *http;49 50 char *auth_params;51 char *token;52 53 char *access_token;54 };55 40 56 41 static char *oauth_sign( const char *method, const char *url, -
lib/oauth.h
r508c340 racba168 22 22 \***************************************************************************/ 23 23 24 /* http://oauth.net/core/1.0a/ */ 25 26 struct oauth_info; 27 typedef void (*oauth_cb)( struct oauth_info * ); 28 29 struct oauth_info 30 { 31 oauth_cb func; 32 void *data; 33 34 struct http_request *http; 35 36 char *auth_params; 37 char *token; 38 39 char *access_token; 40 }; 41 42 /* http://oauth.net/core/1.0a/#auth_step1 (section 6.1) 43 Request an initial anonymous token which can be used to construct an 44 authorization URL for the user. This is passed to the callback function 45 in a struct oauth_info. */ 46 void *oauth_request_token( const char *url, oauth_cb func, void *data ); 47 48 /* http://oauth.net/core/1.0a/#auth_step3 (section 6.3) 49 The user gets a PIN or so which we now exchange for the final access 50 token. This is passed to the callback function in the same 51 struct oauth_info. */ 52 void *oauth_access_token( const char *url, const char *pin, struct oauth_info *st ); 53 54 /* http://oauth.net/core/1.0a/#anchor12 (section 7) 55 Generate an OAuth Authorization: HTTP header. access_token should be 56 saved/fetched using the functions above. args can be a string with 57 whatever's going to be in the POST body of the request. GET args will 58 automatically be grabbed from url. */ 24 59 char *oauth_http_header( char *access_token, const char *method, const char *url, char *args );
Note: See TracChangeset
for help on using the changeset viewer.