【发布时间】:2021-07-31 00:04:30
【问题描述】:
我的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 上,但在 extra data 字段上我只是得到
{
"id": "...",
"email": "...",
"verified_email": true,
"name": "..",
"given_name": "..",
"picture": "..",
"locale": "en"
}
那么生日、性别、地址、年龄范围和其他字段会发生什么变化。
【问题讨论】:
标签: python django google-oauth django-allauth