views:

38

answers:

1

Hi ,

I was creating a twitter application with Django. I used the twitter lib from http://github.com/henriklied/django-twitter-oauth for OAuth , as specified in the twitter example pages .

But I am not too sure how to redirect user to my application home page once the authentication with twitter is over .

The code for

oauth_request = oauth.OAuthRequest.from_consumer_and_token(
    consumer, http_url=REQUEST_TOKEN_URL
)
oauth_request.sign_request(signature_method, consumer, None)
resp = fetch_response(oauth_request, connection)
token = oauth.OAuthToken.from_string(resp)
oauth_request = oauth.OAuthRequest.from_consumer_and_token(
    consumer, token=token, http_url=AUTHORIZATION_URL
)
print(oauth_request.to_url()); 
oauth_request.sign_request(signature_method, consumer, token)
return oauth_request.to_url()
response = HttpResponseRedirect(auth_url)
request.session['unauthed_token'] = token.to_string()   

I even tried passing a "oauth_callback" parameter along with "auth_url" . But after the authentication , it's not redirecting back to my application which is at "http://localhost:8000/myApp/twitter/"

Any clues ? Any pointers ?

Thanks Jijoy

A: 

Check if you have enter the callback url in the details of your Twitter App in http://dev.twitter.com/apps.

Stefano