0

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

2 Answers 2

2

The callback needs to be something like http://local.dev:8080. Twitter doesn't recognize localhost. One thing you probably need to do is go to your etc/hosts file and make sure you add the line 127.0.0.l local.dev

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.