Closed clockworkgr closed 8 years ago
@clockworkgr Thanks for informing us this change! I will look into it.
hey @clockworkgr, your solution works fine, the complete link returns a bunch of information. But we would appreciate it to be a user defined behaviour :) so feel free to change it on your own app, modify this line would be ok: https://github.com/jaredhanson/passport-facebook/blob/master/lib/strategy.js#L59 We would also include this suggestion in doc.Thank you!
Thanks @loay ! For declaring this implementation in loopback-component-passport
README.md:
If more info is required from the Facebook profile such as email, it could still be obtained. In node_modules\passport-facebook\lib\strategy.js
, replace:
this._profileURL = options.profileURL || 'https://graph.facebook.com/me';
with
this._profileURL = options.profileURL ||
'https://graph.facebook.com/v2.2/me?fields=first_name,gender,last_name,link,locale,name,timezone,verified,email,updated_time';
@clockworkgr suggestions looks more clean than the suggestion of changing the profileUrl in the code.
providers.json.template should include:
"profileFields": ["gender","link","locale","name","timezone","verified","email","updated_time"],
OMG why this solution is not in the official documentation?! Please update this page https://docs.strongloop.com/display/public/LB/Tutorial%3A+third-party+login
@crandmck ^
@superkhau I updated http://loopback.io/doc/en/lb2/Configuring-providers.json.html#example-providersjson but now we need to update as well https://github.com/strongloop/loopback-example-passport/blob/master/providers.json.template.
I'll leave that to you or @jannyHou.
Thank you @crandmck . Created a pr to update it in example repo: https://github.com/strongloop/loopback-example-passport/pull/83
More of a heads up for anyone coming across this.
New Apps created in facebook automatically get v2.4 + Graph API and both versioned/unversioned requests are upgraded to 2.4.
Hence: https://graph.facebook.com/v2.2/me with ClientID/ClientSecret from a new app returns ONLY id + name. Even though it's versioned it uses v2.4+)
In order to return to the old behaviour and get the same fields we need to explicitly call
https://graph.facebook.com/v2.2/me?fields=first_name,gender,last_name,link,locale,name,timezone,verified,email,updated_time
This is possible with the profileFields field in the AuthStrategy options.
So providers.json.template should include:
for the facebook-login provider to function as expected