Get the user email and proxied email after authorize app

May 20, 2010 at 9:27 AM

Hi,

i'm trying to get the user email and proxied_email in the post-authorize handler. I tried many ways, but all of them failed. when i try to use FQL for this, it doesn't give any value in this fields. getStandardInfo doesn't work for me (return an empty list) either.

If you have any ideas or working example, i'll be really grateful if you'll share it.

 

Thanks.

Shahar.

Developer
May 22, 2010 at 4:58 AM

You need to ask for the email extended permission and make sure you are using the new data permissions setting in the migrations area of you application settings.

 

May 23, 2010 at 8:28 AM

Hi,

I already have email extended permission and already use the new data permissions. but whatever i use, the email property of the user object is empty, and when I try to use Api.Fql.Query<T> i get an exception  "<user xmlns='http://api.facebook.com/1.0/'> was not expected.".

Thanks.

Developer
May 23, 2010 at 5:50 PM

Do you have the latest source from the latest changeset?  I use getInfo off of user to get the email, have not tried the fql query yet, but my guess is that the email is not on the returned response from the query.  I will look into it later.

 

May 24, 2010 at 6:53 PM
ShaharGS wrote:

Hi,

I already have email extended permission and already use the new data permissions. but whatever i use, the email property of the user object is empty, and when I try to use Api.Fql.Query<T> i get an exception  "<user xmlns='http://api.facebook.com/1.0/'> was not expected.".

Thanks.

This is how I do it (and it works)
using System.Xml.Linq;
---

private string email_address; 

---
---
---

  private void getEmailAddress()
    {

        var response = Master.Api.Fql.Query(String.Format("SELECT email FROM user WHERE uid =  {0}", Session["userid"]));

        XDocument xml = XDocument.Parse(response);

        XNamespace fbns = XNamespace.Get("http://api.facebook.com/1.0/");
        var users = from el in xml.Root.Elements(fbns + "user")
                    select new
                    {
                        email = el.Element(fbns + "email").Value,

                    };

        foreach (var email in users)
        {
            email_address = email.email;
        }

    }