Facebook API - cannot access to mail
See original GitHub issueI can only got name and ID from the facebook API call. In facebook’s “LOGIN PERMISSIONS”, I do see “email”; and in the config I set
'fb': {
'class_': oauth2.Facebook,
# Facebook is an AuthorizationProvider too.
'consumer_key': 'MYSTUFF',
'consumer_secret': 'MYSTUFF',
# But it is also an OAuth 2.0 provider and it needs scope.
'scope': ['email'],
},
I got result.user.data
to be {'name': 'Sean Lao', 'id': '55047288*******'}
– which is good, but – no email!? - and result.user.email
is None
, while result.user.id, result.user.name
work.
The result is obtained through here:
result = authomatic.login(WerkzeugAdapter(request, response), provider_name)
How do I get the email?
P.s. it works only for Yahoo so far. Haven’t tried on Twitter or Google yet.
and btw this is result.user.to_dict()
:
{
'nickname':None,
'provider':'fb',
'first_name':None,
'birth_date':'None',
'id':'MYSTUFF',
'location':None,
'country':None,
'credentials':'2%0A2-5%MYSTUFF',
'phone':None,
'data':{
'id':'MYSTUFF',
'name':'Sean Lao'
},
'name':'Sean Lao',
'locale':None,
'city':None,
'timezone':None,
'last_name':None,
'postal_code':None,
'email':None,
'username':None,
'picture':'http://graph.facebook.com/THIS_ONE_WORKS/picture?type=large',
'gender':None,
'link':None,
'gae_user':None
}
the 'picture':'http://graph.facebook.com/THIS_ONE_WORKS/picture?type=large',
is working, though.
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Facebook Graph API won't return email address - Stack Overflow
Update your-fb-id with your id and go to the above link. Click on 'Get Access Token'. In the tab that opens up, click...
Read more >Why can't get email address? - Developer Community Forum
I read email like this of users of facebook: To show login link: $fb = new Facebook\Facebook([ 'app_id' => '', 'app_secret' => '',...
Read more >Facebook not always returning email for user? · Issue #61
I've looked all over the Facebook docs and can't seem to figure out why, even if I require the email permission, I still...
Read more >How to call the Facebook API and get an OAuth Access Token
Your browser can't play this video. Learn more. Switch camera.
Read more >9 Ways to Use the Facebook API for Your Business [Examples]
The Facebook Graph API provides you access to the social media platform that everyday users can't get. As a business owner or marketer, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not sure if this comes too late, but you can follow the next workaround. Simply put the next sentences before your config:
# Facebook api workaround
oauth2.Facebook.user_info_url = 'https://graph.facebook.com/v2.5/me?fields=id,first_name,last_name,picture,email,gender,timezone,location,middle_name,name_format,third_party_id,website,birthday,locale'
You can tune the fields you are asking to the graph api. The ones I’ve written are more than the ones authomatic handle. You can also tune the graph api version.
Apologies for misreading the scope of that PR. I’ve added a simple PR #167 to explicitly request the fields that were previously provided implicitly (having first merged #164). Comments and testing welcome!