social-app-django: Twitter login not working

Twitter change the callback policy, now when I try to login my callback “oauth/complete/twitter/” not work and twitter return error 403:

`

Request Method: GET
https://homely-dev.herokuapp.com/en/oauth/login/twitter/
1.11.10
HTTPError
403 Client Error: Forbidden for url: https://api.twitter.com/oauth/request_token
/app/.heroku/python/lib/python2.7/site-packages/requests/models.py in raise_for_status, line 935
/app/.heroku/python/bin/python
2.7.14
[‘/app’, ‘/app/.heroku/python/bin’, ‘/app’, ‘/app/.heroku/python/lib/python27.zip’, ‘/app/.heroku/python/lib/python2.7’, ‘/app/.heroku/python/lib/python2.7/plat-linux2’, ‘/app/.heroku/python/lib/python2.7/lib-tk’, ‘/app/.heroku/python/lib/python2.7/lib-old’, ‘/app/.heroku/python/lib/python2.7/lib-dynload’, ‘/app/.heroku/python/lib/python2.7/site-packages’]
Wed, 13 Jun 2018 12:14:52 +0200

`

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 22

Most upvoted comments

I had the same issue and I did solve it by adding

https://mydomain.com/complete/twitter/

to the valid callback url on the twitter app config at https://apps.twitter.com/

Upgrade the following packages to the latest version using pip:

social-auth-app-django
social-auth-core

Steps to follow:

1. Login to you Twitter account 2. Go to https://apps.twitter.com/, and select your application. 3. Select the Settings Tab in the application to configure the Callback URL 4. In the Callback URLs input box, add the following according to the nature of request made: If it is http, without SSL certificate, then add the following:

http://example.com/complete/twitter/
or
http://www.example.com/complete/twitter/

If it is https i.e. it supports SSL certificate (recommended), then add the following:

https://example.com/complete/twitter/
or
https://www.example.com/complete/twiiter/

Note: 1. Make sure the slash( / ) after the twitter is there in the Callback URLs input box 2. Also, replace “example.com” or “www.example.com” with your domain name.

I had the same issue and I have resolved by adding callback urls like

http://localhost:8000/auth/complete/twitter/

i had set “auth” to urls.py for login.

I had this issue and updated my app settings to have something like these. Note the forward slashes

http://mydomain.com/complete/twitter/
http://www.mydomain.com/complete/twitter/

You can update the app settings in https://apps.twitter.com

Same issue, changes made but without luck, i still have the 403 Client Error. Is there some other workaround?

If you’re running on localhost and you still get the error. Make sure the port you’re running on matches the port you presented on Twitter CALLBACK URLS

Example I’m running on port 9900 so this worked for me http://127.0.0.1:9900/oauth/complete/twitter/

instead of http://localhost:8000/oauth/complete/twitter/ or http://localhost:9900/oauth/complete/twitter/

The above redirect urls seems to be not working but the below ones did

https://mysite.com:8000/social-authcomplete/facebook/ https://mysite.com:8000/social-authcomplete/twitter/

Twitter has used the white list since a week ago. So if you engaged this problem, you may update your callback url (here)[https://apps.twitter.com/].