Facebook External not getting value by email in Nopcommerce 3.60
I am currently using NopCommerce 3.60 and using an external FB login.
Problem:
After I login to Nop via external FB button and go back to URL mydomain.com/login#_=__ with red message (email required) and it won't login. Screenshot: http://postimg.org/image/wvgu6wvud/
What I tried:
Reinstall Nop from scratch and below settings
Presetting and Option I:
- Externalauthenticationsettings.requireemailvalidation False
- Automatic register enabled: Checked .
- Registration method: Email check
I am trying to debug the source code in the file name FacebookProviderAuthorizer.cs in the Nop.Plugin.ExternalAuth.Facebook folder and also does not get the email value. http://postimg.org/image/qwmphn9tn/
Ask someone to suggest me what to do next for this problem.
source to share
I'm not familiar with Nop, but it is possible to register with Facebook without email. This is why most of the libraries for checking fb-oauth against email and if there is no email they create the email address user-id@facebook.com.
Perhaps your Nop fb-oauth library is out of date?
So please check if there is such a function - if not, you may have problems.
source to share
Somehow FB doesn't include email in oauth. You can use this method to receive email and submit that registration email.
//as part of the uri for the webrequest, include all the fields you want to use
var request = WebRequest.Create("https://graph.facebook.com/me?fields=email,name&access_token=" + Uri.EscapeDataString(authorization.AccessToken));
using (var response = request.GetResponse())
{
using (var responseStream = response.GetResponseStream())
{
System.IO.StreamReader streamReader = new System.IO.StreamReader(responseStream, true);
string MyStr = streamReader.ReadToEnd();
JObject userInfo = JObject.Parse(MyStr);
//now you can access elements via:
// (string)userInfo["name"], userInfo["email"], userInfo["id"], etc.
}
}
source to share