Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grab user's Email during authentication with Twitter #825

Closed
halfstrik opened this issue Jan 22, 2016 · 5 comments
Closed

Grab user's Email during authentication with Twitter #825

halfstrik opened this issue Jan 22, 2016 · 5 comments

Comments

@halfstrik
Copy link

Greetings!

I perform a little googling and find out that Twitter recently adds optional returning of users Email address.
Look at the end of this long thread and Twitter docs.

In short, if your app is approved by Twitter and you provide links to ToS and Privacy Policy for your site, you can (as they claim) get a user email address by providing include_email in request to endpoint https://api.twitter.com/1.1/account/verify_credentials.json.

Does any one succeed at this? Any thoughts?

@evcb
Copy link
Contributor

evcb commented Jan 25, 2016

I submitted a request to Twitter asking for more user details (including e-mail) for my app. They approved, I changed social-auth's parameters and I am still unable to get the e-mail in the request.
It would be interesting to know if someone succeeded in this.

@halfstrik
Copy link
Author

I managed to get it right and actually receive user email!

For this several steps need to be done (see this post)

Make sure Twitter respond to you via email and approved that your app actually get white-listed.

Than this changes need to be done in python-social-auth app in python/lib/python2.7/site-packages/social/backends/twitter.py:
line 30: 'email': response.get('email'),
line 38: 'https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true',

In other words, Parameters from Twitter documentation must go not to access_token object, but rather to URL as path params.

I'll try to create a pull request for this as soon as I understand how this app works on examples with Facebook and similar.

@evcb
Copy link
Contributor

evcb commented Jan 28, 2016

It worked, @halfstrik. It should be fixed in the app and updated in the documentation.

@halfstrik
Copy link
Author

@hellvix, great to hear it! I updated appropriate docs/ files in this PR as well.

The things I'm unsure are the name of the variable in settings and a quality of my test.
Will wait @omab for judgments:)

@omab
Copy link
Owner

omab commented Dec 26, 2016

Fix already merged, thanks!

@omab omab closed this as completed Dec 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants