using System.Web.Mvc;
using NGM.OpenAuthentication.Core.OAuth;
using Orchard;

namespace NGM.Social.Controllers {
    public class FacebookController : Controller {
        private readonly IOAuthProviderFacebookAuthenticator _facebookProviderAuthenticator;
        private readonly IOrchardServices _orchardServices;

        public FacebookController(IOAuthProviderFacebookAuthenticator facebookProviderAuthenticator, IOrchardServices orchardServices) {
            _facebookProviderAuthenticator = facebookProviderAuthenticator;
            _orchardServices = orchardServices;
        }

        public ViewResult RetrieveName() {
            var client = _facebookProviderAuthenticator.GetClient(_orchardServices.WorkContext.CurrentUser);

            //http://blog.prabir.me/post/Facebook-CSharp-SDK-Writing-your-first-Facebook-Application.aspx
            dynamic result = client.Get("/me");
            var name = result.name;

            return null;
        }
    }
}

Last edited May 30, 2011 at 2:49 PM by Jetski5822, version 3

Comments

No comments yet.