public string GetUsername()
        {
            FacebookRESTClient client = new FacebookRESTClient(FacebookApiKeys.GetApiKey(), TokenSecret, Token, TokenSecret);
            var user = client.GetLoggedInUser();

            return(user.Name);
        }
        public Uri BuildRedirectUri()
        {
            // The API then piggy backs off the same login mechanism as used by the desktop
            // client but uses the cloud specific API keys. FB expects the domain name to be something like
            // www.<environment>.inbox2.com in that case.
            string environment      = "/Settings/Application/Environment".AsKey(String.Empty);
            var    cloudRedirectUrl = String.IsNullOrEmpty(environment)
                                ? "http://www.inbox2.com/"
                                : String.Concat("http://www.", environment, ".inbox2.com");

            return(new Uri(String.Format("http://www.facebook.com/login.php?api_key={0}&connect_display=popup&v=1.0&next={1}&fbconnect=true&return_session=true&skipcookie=true&req_perms=read_stream,read_mailbox,publish_stream,offline_access",
                                         FacebookApiKeys.GetApiKey(), IsCloudRedirect ? cloudRedirectUrl : "http://desktop.inbox2.com/success")));
        }
Beispiel #3
0
        void BuildRestClient()
        {
            if (client == null)
            {
                var sessionKey    = ChannelContext.Current.ClientContext.GetSetting("/Channels/Facebook/SessionKey").ToString();
                var sessionSecret = ChannelContext.Current.ClientContext.GetSetting("/Channels/Facebook/SessionSecret").ToString();

                var apiKey    = FacebookApiKeys.GetApiKey();
                var apiSecret = FacebookApiKeys.GetApiSecret();

                if ("/Settings/Channels/Codebase".AsKey("cloud") == "client")
                {
                    client = new FacebookRESTClient(apiKey, sessionSecret, sessionKey, sessionSecret);
                }
                else
                {
                    client = new FacebookRESTClient(apiKey, apiSecret, sessionKey, sessionSecret);
                }
            }
        }