简体   繁体   English

使用Django和django-allauth获取新用户的Twitter电子邮件地址

[英]Getting a new user's Twitter email address with Django and django-allauth

I'm using the latest version of django-allauth and Django 1.8. 我正在使用最新版本的django-allauth和Django 1.8。

I have a custom user model which requires an email address. 我有一个自定义用户模型,需要一个电子邮件地址。

When somebody creates a new user by connecting their Twitter account, they are (after a successful OAuth connection) asked for their email address by allauth. 当某人通过连接他们的Twitter帐户创建新用户时,他们(在成功的OAuth连接之后)通过allauth询问他们的电子邮件地址。

Allauth has no issue with Facebook or Google. Allauth对Facebook或Google没有任何问题。

I briefly explored adding email prefill to my custom adapter (a few small changes to DefaultSocialAccountAdapter ), but the user's email address isn't even in extra_data . 我简要地探讨了将电子邮件extra_data添加到我的自定义适配器(对DefaultSocialAccountAdapter的一些小改动),但用户的电子邮件地址甚至extra_data

Does Twitter purposely not allow you to get a user's email address? Twitter故意不允许您获取用户的电子邮件地址吗? It really breaks the flow of my application, as it requires the user to confirm their email address, which is half the point of using social logins in the first place! 它确实打破了我的应用程序的流程,因为它要求用户确认他们的电子邮件地址,这是首先使用社交登录的一半!

Thanks. 谢谢。

I think before you doing with django-allauth you may need to look at this verify_credentials . 我想在你使用django-allauth之前,你可能需要查看这个verify_credentials

And also you have to fill the form and get the approval from Twitter. 而且你必须填写表格并获得Twitter的批准。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM