微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

django-allauth 不保存谷歌额外数据

如何解决django-allauth 不保存谷歌额外数据

我的settings.py怎么样了

# other settings

SOCIALACCOUNT_PROVIDERS = {
    'facebook': {
        'ScopE': [
            'email','public_profile','user_friends','user_gender','user_birthday','user_location','user_link','user_age_range',],'FIELDS': [
            'id','first_name','last_name','middle_name','name','short_name','name_format','gender','birthday','age_range','friends','location','picture','link','EXCHANGE_TOKEN': True,'VERIFIED_EMAIL': False,'VERSION': 'v7.0',},'google': {
        'ScopE': [
            'https://www.googleapis.com/auth/userinfo.profile','https://www.googleapis.com/auth/userinfo.email','https://www.googleapis.com/auth/user.emails.read','https://www.googleapis.com/auth/user.phonenumbers.read','https://www.googleapis.com/auth/user.birthday.read','https://www.googleapis.com/auth/profile.agerange.read','https://www.googleapis.com/auth/user.addresses.read','AUTH_ParaMS': {
            'access_type': 'online',}
    }
}

它在 facebook 上运行良好,我在那里得到了我想要的东西,但是在 google 下,一切都会在签名时正常工作(请求权限......一切都会)它会进行身份验证用户并将其保存在 db 上,但在 额外数据 字段上我只是得到

{
  "id": "...","email": "...","verified_email": true,"name": "..","given_name": "..","picture": "..","locale": "en"
}

那么生日性别地址年龄范围和其他字段会发生什么变化。

解决方法

数据保护字段,例如生日、性别、地址、年龄范围,通常默认设置为私人。因此,外部 API 访问仅限于该给定用户的公共字段。

例如,生日:

如果您访问自己帐户的 birthday。您会注意到它可能被设置为 'Only Me',表示它被设置为私有。

为了访问您被限制访问的所有字段,您必须为所有组件更改此配置文件配置,使它们公开

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。