3

Currently I use NopCommerce 3.60 and use FB External Login.

Problem:

After I login in Nop by FB External Button and it returns to URL mydomain.com/login#_=__ with red message (Email is required) and it does not login user in. Screenshot: http://postimg.org/image/wvgu6wvud/

What I was try:

Reinstall Nop from scratch and has below setting

In advance setting and option I has:

  • Externalauthenticationsettings.requireemailvalidation False
  • Auto register enabled: Checked.
  • Registration method: Email Validation

I try to debug source code in file name FacebookProviderAuthorizer.cs in Nop.Plugin.ExternalAuth.Facebook folder and also does not get email value too.http://postimg.org/image/qwmphn9tn/

Have anyone suggest me what to do next for this problem please.

WilliamSOW
  • 31
  • 6
  • Is your app using API v2.4? If so, it most likely has to do with the change that not all fields are returned by default any more, but have to be asked for specifically. If the actual API request is not exposed to you in the code, but handled by the framework itself – then you need to ask the creator of the framework to update it accordingly. – CBroe Jul 27 '15 at 08:44

3 Answers3

2

Fixed. You can see changeset 5bb6815e30ee

Eray Aydogdu
  • 240
  • 1
  • 4
  • 16
1

I am not familiar with Nop, but it is possible to register at Facebook without an email. This is why most libraries for fb-oauth checking against eMail and if there is no email, they create an user-id@facebook.com eMail address.

Maybe your Nop library of fb-oauth is out dated?

So please check if there is such a function - if not, you might got your problem.

Jurik
  • 3,244
  • 1
  • 31
  • 52
1

Somehow FB doesn't include email in oauth. You can use this method to get email and supply that email to register.

//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.
    }
}
kai
  • 11
  • 1