Help with oauth and https


#1

Hello,

I’m new to ajax and I’m having problems making a request with https as apposed to http using oauth. I’m not sure how to make a request using oauth with a secure url i.e., https://stream.twitter.com/1/statuses/sample.json I can use a non secure url i.e., http://api.twitter.com/1/statuses/home_timeline.json but when I use https:// I get ERROR 400 Bad Request. When I use curl https://stream.twitter.com/1/statuses/sample.json -uusername:password in my shell I get the stream, I just don’t know how to do that in the oauth request:

@dajaxice_register
def get_home_timeline(request):
		username = settings.TWITTER_USERNAME
		password = re.escape(settings.TWITTER_PASSWORD)
		url = 'https://stream.twitter.com/1/statuses/sample.json?delimited=length -u%s:%s' % (username, password)
		home_timeline = oauth_req(
		url,
		settings.TWITTER_TOKEN_KEY,
		settings.TWITTER_TOKEN_SECRET
		)
		return simplejson.dumps({'home_timeline': home_timeline })

Thanks for any help,

J


#2

OAuth and the Streaming API both aren’t to be used via AJAX. You’ll need to server-to-server connections to manage the OAuth flow and the Streaming API.


#3

Thanks for the insight.