Facebook Connect for simple authentication?
        Posted  
        
            by Starnzy
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Starnzy
        
        
        
        Published on 2009-10-27T15:28:16Z
        Indexed on 
            2010/03/26
            22:03 UTC
        
        
        Read the original article
        Hit count: 392
        
Hi
I have an ASP.net website which I want to introduce 'Facebook Connect' functionality into, purely for account login/creation purposes. I want a user to be able to click the 'Login using Facebook' type button, and to then log that user into my website based on a userid lookup from the Facebook response.
I have a couple of questions surrounding this:
- Presumeably I can do all of this using the Facebook API - without the need for an actual pretty public facing 'application' on Facebook? I simply want to utilise the Facebook API for authenticating an account. I'm not interested in creating some app for doing something 'within' facebook itself. 
- I have located some code snippets online and tried using the Facebook Developer Toolkit, calling the getInfo method, and whilst it does come back to my website with a uid, none of the other user information is present within the response, like Email, Name etc. The uid is the only populated field in the response. 
Here is the code I use:
if (ConnectAuthentication.isConnected())
        {
            API api = new API();
            api.ApplicationKey = ConnectAuthentication.ApiKey;
            api.SessionKey = ConnectAuthentication.SessionKey;
            api.Secret = ConnectAuthentication.SecretKey;
            api.uid = ConnectAuthentication.UserID;
            //Display user data captured from the Facebook API.
            facebook.Schema.user facebookUser = null;
            try
            {
                facebookUser = api.users.getInfo();
                User user = new User();
                user.FacebookUser = facebookUser;
                user.IsFacebookUser = true;
                return user;
            }
            catch { return null; }
        }
        else
        {
            return null;
        }
Can anyone please help with either/both of these queries?
Thanks in advance...
© Stack Overflow or respective owner