(define twitter (make-oauth-service-provider protocol-version: '1.0a credential-request-url: "https://api.twitter.com/oauth/request_token" owner-auth-url: "https://api.twitter.com/oauth/authorize" token-request-url: "https://api.twitter.com/oauth/access_token" signature-method: 'hmac-sha1)) ;;; Set up the application to include your secret tokens (available at ;;; apps.twitter.com) (define twitter-app (make-oauth-service service: twitter client-credential: (make-oauth-credential "MySecret" "MySecret"))) ;;; Using the rest-bind egg, we can verify our ;;; credentals... ;;; https://dev.twitter.com/rest/reference/get/account/verify_credentials (define-method (verify-credentials #!key include_entities skip_status) "https://api.twitter.com/1.1/account/verify_credentials.json" #f read-json #f) ;;; Set up some credentials (define x (acquire-temporary-credential twitter-app)) ;;; This is the VERIFIER URL for including in the call below (uri->string (authorize-resource-owner twitter-app x)) ;;; Visit the supplied URL in browser, allow app and retrive verifier (define me (acquire-token-credential twitter-app x )) ;;; This works for REST API (with-oauth twitter-app me (lambda () (call-with-input-request "https://api.twitter.com/1.1/search/tweets.json?q=%23freebandnames&since_id=24012619984051000&max_id=250126199840518145&result_type=mixed&count=4" #f (cut read-string #f <>)))) ;;; Now, with streaming API we get nothing... (with-oauth twitter-app me (lambda () (call-with-input-request "https://stream.twitter.com/1.1/statuses/filter.json?delimited=length&track=espn" #f (cut read-string #f <>))))