public void Login()
        {
            m_LoginResult = FacebookService.Login(
                "129594497748718", // My AppId: 129594497748718 ,Course AppId: 1450160541956417
                "public_profile",
                "user_about_me",
                "user_relationships",
                "user_relationship_details",
                "user_birthday",
                "user_friends",
                "publish_actions",
                "user_events",
                "user_posts",
                "user_photos",
                "user_status");

            if (!string.IsNullOrEmpty(m_LoginResult.AccessToken))
            {
                m_LoggedInUser = m_LoginResult.LoggedInUser;
            }
            else
            {
                throw new Exception(m_LoginResult.ErrorMessage);
            }

            if (LoginFinished != null)
            {
                LoginFinished.Invoke(this, EventArgs.Empty);
            }
        }
Exemple #2
0
 public void loginToFacebook()
 {
     m_Result = FacebookService.Login(
         AppID,
         "public_profile",
         "user_birthday",
         "user_actions.video",
         "user_actions.news",
         "user_actions.music",
         "user_actions.books",
         "user_about_me",
         "user_friends",
         "publish_actions",
         "user_events",
         "user_hometown",
         "user_likes",
         "user_location",
         "user_managed_groups",
         "user_photos",
         "user_posts",
         "user_relationships",
         "user_relationship_details",
         "user_religion_politics",
         "user_tagged_places",
         "user_videos",
         "user_website",
         "user_work_history",
         "read_custom_friendlists",
         "publish_pages",
         "publish_actions",
         "rsvp_event");
     m_LoggedInUser = m_Result.LoggedInUser;
     setPropertiesAfterLogin();
 }
        public void Login()
        {
            const string guyID   = "1450160541956417";
            const string yossiID = "478629669585789";

            if (string.IsNullOrEmpty(AccesToken))
            {
                LoginResult result = FacebookService.Login(
                    yossiID,
                    "public_profile",
                    "email",
                    "publish_to_groups",
                    "user_birthday",
                    "user_age_range",
                    "user_gender",
                    "user_link",
                    "user_tagged_places",
                    "user_videos",
                    "publish_to_groups",
                    "groups_access_member_info",
                    "user_friends",
                    "user_events",
                    "user_likes",
                    "user_location",
                    "user_photos",
                    "user_posts",
                    "user_hometown");

                initUserAndData(result);
            }
            else
            {
                throw new Exception(k_ErrorUserAlredyConnectMsg);
            }
        }
 public PostsController(PostsDbContext dbContext, IConfiguration configuration, ImageLoaderService service)
 {
     this._dbContext  = dbContext;
     _configuration   = configuration;
     _facebookService = new FacebookService(new FacebookClient());
     _imgLoader       = service;
 }
Exemple #5
0
        internal SearchIndex(FacebookService service)
        {
            _service = service;

            // Sign up for collection change notifications for incremental index updates.
            //_service.Friends.CollectionChanged += new NotifyCollectionChangedEventHandler(OnFriendsCollectionChanged);
            //_service.NewsFeed.CollectionChanged += new NotifyCollectionChangedEventHandler(OnNewsFeedCollectionChanged);
            //_service.FriendsPhotoAlbums.CollectionChanged += new NotifyCollectionChangedEventHandler(OnAlbumsCollectionChanged);
            //_service.MyPhotoAlbums.CollectionChanged += new NotifyCollectionChangedEventHandler(OnAlbumsCollectionChanged);

            //foreach (ActivityPost post in _service.NewsFeed)
            //{
            //    post.Comments.CollectionChanged += new NotifyCollectionChangedEventHandler(OnCommentsCollectionChanged);
            //}

            //foreach (FacebookPhotoAlbum album in _service.FriendsPhotoAlbums)
            //{
            //    album.Photos.CollectionChanged += new NotifyCollectionChangedEventHandler(OnPhotosCollectionChanged);
            //}

            //foreach (FacebookPhotoAlbum album in _service.MyPhotoAlbums)
            //{
            //    album.Photos.CollectionChanged += new NotifyCollectionChangedEventHandler(OnPhotosCollectionChanged);
            //}

            //BuildIndex();
        }
        public static bool TryToLogIn()
        {
            s_LoginResult = FacebookService.Login("909882489077378", "user_birthday", "email", "user_hometown", "user_about_me", "user_photos", "publish_actions", "user_status", "user_tagged_places", "read_stream", "user_groups", "user_friends"); //, "user_about_me", "user_friends", "publish_actions", "user_events", "user_posts", "user_photos", "user_birthday",
                                                                                                                                                                                                                                                       // "user_status", "read_stream", "user_posts", "user_birthday", "email", "user_hometown", "user_about_me", "user_photos", "publish_actions", "user_status", "user_tagged_places", "read_stream", "user_groups", "user_friends");

            return(IsConnected);
        }
Exemple #7
0
        public static IEnumerable <FacebookPost> GetLastestFacebookPosts(object OAuthValue)
        {
            // Get the OAuth information stored in the property
            FacebookOAuthData facebook = OAuthValue as FacebookOAuthData;

            // Check whether the OAuth data is valid
            if (facebook != null && facebook.IsValid)
            {
                // Gets an instance of FacebookService based on the OAuth data
                FacebookService service = facebook.GetService();

                // Get information about the authenticated user
                FacebookUser me = service.Users.GetUser("me").Body;

                // Gets the most recent posts of the authenticated user (me)
                FacebookPostsResponse response = service.Posts.GetPosts(new FacebookGetPostsOptions
                {
                    Identifier = "me",
                    Fields     = "id,name,message,story,created_time,picture,link,description,status_type,type,likes",
                    Limit      = 25
                });

                return(response.Body.Data.ToList());
            }
            return(null);
        }
Exemple #8
0
        // singleton end-----


        public bool loginAndInit()
        {
            LoggedInUser = new MyUser();

            LoginResult result = FacebookService.Login(
                "280166285895285",
                "public_profile",
                "user_friends",
                "user_gender",
                "user_birthday",
                "user_posts",
                "user_events",
                "user_hometown",
                "user_likes",
                "user_location",
                "user_photos",
                "user_posts",
                "user_tagged_places",
                "user_videos",
                "manage_pages",
                "publish_pages"
                );

            if (!string.IsNullOrEmpty(result.AccessToken)) // If there is access token
            {
                LoggedInUser.User = result.LoggedInUser;   //Fill 'User' with data from 'Login Result'
                m_User            = LoggedInUser.User;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #9
0
        public void LoginUser()
        {
            LoginResult result = FacebookService.Login("2287651948215911",
                                                       "public_profile",
                                                       "email",
                                                       "publish_to_groups",
                                                       "user_birthday",
                                                       "user_age_range",
                                                       "user_gender",
                                                       "user_link",
                                                       "user_videos",
                                                       "publish_to_groups",
                                                       "groups_access_member_info",
                                                       "user_friends",
                                                       "user_events",
                                                       "user_likes",
                                                       "user_location",
                                                       "user_photos",
                                                       "user_posts"
                                                       );

            m_LoggedInUser = result.LoggedInUser;
            AppSetting.Instance.AccessToken = result.AccessToken;
            FetchUserInfo();
        }
 public void LogOut()
 {
     if (m_LoggedInUser != null)
     {
         FacebookService.Logout(() => m_LoggedInUser = null);
     }
 }
Exemple #11
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            LoginResult result = FacebookService.Login(
                "1450160541956417",
                "email",
                "user_posts",
                "user_friends",
                "user_likes",
                "user_photos",
                "user_events",
                "user_birthday",
                "user_location",
                "user_gender",
                "user_tagged_places");

            m_Settings.AccessToken = result.AccessToken;

            if (!string.IsNullOrEmpty(result.AccessToken))
            {
                m_FacebookUser = result.LoggedInUser;
                reloadUI();
            }
            else
            {
                MessageBox.Show(result.ErrorMessage);
            }
        }
        private void loginAndInit()
        {   //we used guy's app ID. Our app ID is "515144672559542"
            this.m_LoggedInResult = FacebookService.Login(
                "1450160541956417",
                "user_birthday",
                "user_age_range",
                "user_gender",
                "user_friends",
                "user_likes",
                "user_photos",
                "user_posts",
                "user_hometown",
                "email"
                );

            if (!string.IsNullOrEmpty(this.m_LoggedInResult.AccessToken))
            {
                this.m_LoggedInUser = this.m_LoggedInResult.LoggedInUser;
                this.setFormInfo();
            }
            else
            {
                MessageBox.Show(this.m_LoggedInResult.ErrorMessage);
            }
        }
Exemple #13
0
        public bool ValidaUsuarioFacebook()
        {
            var facebookClient  = new FacebookClient();
            var facebookService = new FacebookService(facebookClient);
            var getAccountTask  = facebookService.GetAccountAsync(FacebookSettings.AccessToken);

            Task.WaitAll(getAccountTask);
            var account = getAccountTask.Result;

            if (getAccountTask.IsCompletedSuccessfully)
            {
                return(true);
            }
            else
            {
                return(false);
            }
            //var cont = account.Id;
            //var nome = account.Name;
            //Console.WriteLine($"{account.Id} {account.Name}");

            //var postOnWallTask = facebookService.PostOnWallAsync(FacebookSettings.AccessToken,
            //"Hello from C# .NET Core!");
            //Task.WaitAll(postOnWallTask);
        }
Exemple #14
0
        // GET: Home
        public ActionResult Index()
        {
            AccountDAO dao = new AccountDAO();

            List <AccountDO> getAll = dao.Carregar();

            var accessToken     = _token;
            var facebookClient  = new FacebookClient();
            var facebookService = new FacebookService(facebookClient);
            var account         = facebookService.GetAccount(accessToken);

            AccountDO accDO = new AccountDO()
            {
                Id        = account.Id,
                Name      = account.Name,
                FirstName = account.FirstName,
                LastName  = account.LastName
            };

            dao.Salvar(accDO);

            ViewBag.AccountId   = account.Id;
            ViewBag.AccountName = account.Name;

            return(View());
        }
        public void LoginAndInit()
        {
            LoginResult result = FacebookService.Login(k_AppId,
                                                       "public_profile",
                                                       "email",
                                                       "publish_to_groups",
                                                       "user_birthday",
                                                       "user_age_range",
                                                       "user_gender",
                                                       "user_link",
                                                       "user_tagged_places",
                                                       "user_videos",
                                                       "groups_access_member_info",
                                                       "user_friends",
                                                       "user_events",
                                                       "user_likes",
                                                       "user_location",
                                                       "user_photos",
                                                       "user_posts",
                                                       "user_hometown");

            if (!string.IsNullOrEmpty(result.AccessToken))
            {
                m_LoggedInUser = result.LoggedInUser;
            }
            else
            {
                throw (new Exception(result.ErrorMessage));
            }
        }
        public bool Login()
        {
            bool res = false;

            this.LoginResult = FacebookService.Login(
                AppID,
                "email",
                "public_profile",
                "user_friends",
                "user_likes",
                "user_photos",
                "user_posts",
                "user_birthday",
                "user_events",
                "manage_pages",
                "user_location",
                "user_gender");

            if (!string.IsNullOrEmpty(this.LoginResult.AccessToken))
            {
                LoggedUser = this.LoginResult.LoggedInUser;
                res        = true;
            }

            return(res);
        }
 private static void commitLogin(string i_AppID)
 {
     if (sm_LoginResult == null)
     {
         sm_LoginResult = FacebookService.Login(i_AppID,
                                                "public_profile",
                                                "email",
                                                "user_birthday",
                                                "user_age_range",
                                                "user_gender",
                                                "user_link",
                                                "user_tagged_places",
                                                "user_videos",
                                                "user_friends",
                                                "user_events",
                                                "user_likes",
                                                "user_location",
                                                "user_photos",
                                                "user_posts",
                                                "user_hometown",
                                                "user_managed_groups",
                                                "user_status"
                                                );
     }
 }
Exemple #18
0
        public void RegisterUser(JsonObject ps)
        {
            Profile p = new Profile();

            ProfileManager pm = new ProfileManager();

            FacebookService fb = new FacebookService();
            Facebook.JsonObject o = fb.DownloadData<Facebook.JsonObject>("/me", ps["accessToken"].ToString());

            if (pm.LoadUser(o["email"].ToString()) != null)
                throw new Exception("Profile already exists");

            p.CreationDate = DateTime.Now;
            p.Email = o["email"].ToString();
            p.IsLockedOut = false;

            if (o.ContainsKey("username"))
                p.UserName = o["username"].ToString();
            else
                p.UserName = ps["userID"].ToString();

            pm.RegisterUser(p);

            SocialConnection sc = new SocialConnection();
            sc.OauthToken = ps["accessToken"].ToString();
            sc.ReferenceID = ps["userID"].ToString();
            sc.ServiceID = SocialServiceType.Facebook;
            sc.UserID = p.UserID;

            SocialServiceManager scm = new SocialServiceManager();
            scm.AddConnection(sc);

            pm.ReleaseAuthenticationTicket(p);
        }
        private void FaceBookShare()
        {
            //Start Social
            // 1. Create the service
            var facebook = new FacebookService {
                ClientId    = "398589866823247",
                RedirectUrl = new System.Uri("http://www.laftrip.com/jokes")
            };


            // 2. Create an item to share
            var item = new Item {
                Text = joketitle
            };

            item.Links.Add(new Uri(String.Format("{0}/Details/{1}", url, jokeid)));

            // 3. Present the UI on iOS
            var shareController = facebook.GetShareUI(item, result => {
                // result lets you know if the user shared the item or canceled
                DismissViewController(true, null);
            });

            PresentViewController(shareController, true, null);

            //End Social
        }
Exemple #20
0
        private void loginAndInit()
        {
            /// Owner: design.patterns

            /// Use the FacebookService.Login method to display the login form to any user who wish to use this application.
            /// You can then save the result.AccessToken for future auto-connect to this user:
            LoginResult result = FacebookService.Login("2010645948945916",
                                                       "public_profile",
                                                       "user_events",
                                                       "user_friends",
                                                       "user_birthday",
                                                       "user_photos",
                                                       "user_likes",
                                                       "user_posts");



            if (!string.IsNullOrEmpty(result.AccessToken))
            {
                m_LoggedInUser = result.LoggedInUser;
                fetchUserInfo();
            }
            else
            {
                MessageBox.Show(result.ErrorMessage);
            }
        }
Exemple #21
0
        internal static bool LoginAndInit(out string o_AccessToken)
        {
            LoginResult loginResult      = null;
            bool        isLoginSucceeded = false;

            o_AccessToken = null;

            try
            {
                loginResult = FacebookService.Login("2731122040258680", "public_profile", "user_birthday", "user_photos");

                if (!string.IsNullOrEmpty(loginResult.AccessToken))
                {
                    isLoginSucceeded = true;
                    o_AccessToken    = loginResult.AccessToken;
                    LoggedInUser     = loginResult.LoggedInUser;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(isLoginSucceeded);
        }
Exemple #22
0
 private static LoginResult login()
 {
     return(FacebookService.Login(
                "262112287500552",
                "public_profile",
                "user_friends",
                "email",
                "user_about_me",
                "user_birthday",
                "user_education_history",
                "user_events",
                "user_games_activity",
                "user_hometown",
                "user_likes",
                "user_location",
                "user_managed_groups",
                "user_photos",
                "user_posts",
                "publish_actions",
                "user_relationships",
                "user_relationship_details",
                "user_religion_politics",
                "user_tagged_places",
                "user_videos",
                "user_website",
                "user_work_history",
                "read_custom_friendlists",
                "user_status"));
 }
        public void LoginUser(bool i_IsNeedToRemember)
        {
            if (SavedAppSettings.RememberMe)
            {
                UserLoginResult = FacebookService.Connect(SavedAppSettings.AccessToken);
            }
            else
            {
                UserLoginResult = FacebookService.Login(
                    "316345936393858",
                    "user_birthday",
                    "user_friends",
                    "user_hometown",
                    "user_likes",
                    "user_photos",
                    "user_posts",
                    "user_videos",
                    "user_link");
            }

            LoggedInUser = UserLoginResult.LoggedInUser;
            SavedAppSettings.RememberMe  = i_IsNeedToRemember;
            SavedAppSettings.AccessToken = UserLoginResult.AccessToken;
            PostedStatuses = new LinkedList <StatusProxy>();
        }
Exemple #24
0
 public ProfileService()
 {
     account   = AccountStore.Create(Forms.Context).FindAccountsForService("facebook").FirstOrDefault();
     fbService = new FacebookService {
         ClientId = AuthHelpers.ClientId
     };
 }
Exemple #25
0
        public void Login()
        {
            LoginResult result = FacebookService.Login("419878648523017", "public_profile", "email", "user_friends", "user_photos", "user_birthday", "user_likes", "manage_pages", "user_events", "user_hometown", "user_posts", "user_tagged_places", "user_location");

            LoggedInUser             = result.LoggedInUser;
            Settings.LastAccessToken = result.AccessToken;
        }
        public async Task <IActionResult> Create([Bind("Key,Target,DateOfFlight,FlightNumber,CancleFee,Food,Baggage,Class,Price")] PlainTickets plainTickets)
        {
            if (ModelState.IsValid)
            {
                plainTickets.IsSold = false;
                //TODO: add owner id
                plainTickets.OwnerId = 1;
                _context.Add(plainTickets);
                await _context.SaveChangesAsync();

                try
                {
                    var accessToken     = "EAAehTCoOZARcBACAZChZBnQR1P3XcsV0v1yOFqP7nMSqZA16Stn0rGypJ5jO6ixTp429aMHkEoZAwuQR5zQnXRlq3vqLmM5iBzhtBqJjFnOOLL0cqwCdjkZBGqp6ZCaAZCW7nZB3prL3EZCLnMQnCJin722b8WIpEymkQIbtvvDaMNgodP0wNoIK48C7OPxHOj4XjdZAHTVi0L17QZDZD";
                    var facebookClient  = new FacebookClient();
                    var facebookService = new FacebookService(facebookClient);

                    var postOnWallTask = facebookService.PostOnWallAsync(accessToken, "New destination only" + plainTickets.Price + "$");
                    Task.WaitAll(postOnWallTask);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                return(RedirectToAction(nameof(Index)));
            }
            return(View(plainTickets));
        }
        public static AppEngine Login()
        {
            LoginResult loginResult = FacebookService.Login(

                /*"user_relationships",
                 * "user_relationship_details",
                 * "user_work_history",*/
                "2246590548924227",
                "public_profile",
                "user_birthday",
                "user_gender",
                "user_friends",
                "user_events",
                "user_hometown",
                "user_likes",
                "user_location",
                "user_tagged_places",
                "user_photos",
                "user_posts");

            // The documentation regarding facebook login and permissions can be found here:
            // https://developers.facebook.com/docs/facebook-login/permissions#reference
            if (!string.IsNullOrEmpty(loginResult.AccessToken))
            {
                AppSettings.Settings.LastAccessToken = loginResult.AccessToken;
                return(new AppEngine(new AppUser(loginResult.LoggedInUser)));
            }
            else
            {
                throw new Exception(loginResult.ErrorMessage);
            }
        }
Exemple #28
0
        internal FacebookImage(FacebookService service, Uri normal, Uri big, Uri small, Uri square)
        {
            Assert.IsNotNull(service);
            SourceService = service;

            if (normal != null)
            {
                _normal = new SmallUri(normal.OriginalString);
                SourceService.WebGetter.QueueImageRequest(_normal.Value);
            }
            if (small != null)
            {
                _small = new SmallUri(small.OriginalString);
                SourceService.WebGetter.QueueImageRequest(_small.Value);
            }
            if (big != null)
            {
                _big = new SmallUri(big.OriginalString);
                SourceService.WebGetter.QueueImageRequest(_big.Value);
            }
            if (square != null)
            {
                _square = new SmallUri(square.OriginalString);
                SourceService.WebGetter.QueueImageRequest(_square.Value);
            }
        }
Exemple #29
0
        private void fetchSingleFriendsLists()
        {
            User fullFriend;
            bool isSingleFriend;
            bool isMaleFriend;
            FacebookObjectCollection <User> friends = m_Manger.FetchMyfriends();

            foreach (User friend in friends)
            {
                fullFriend     = FacebookService.GetObject <User>(friend.Id, User.s_FieldsToLoadFull[DynamicWrapper.eLoadOptions.Full]);
                isSingleFriend = isFriendSingle(fullFriend);

                if (isSingleFriend == true)
                {
                    isMaleFriend = isFriendMale(fullFriend);
                    if (isMaleFriend == true)
                    {
                        listBoxMaleSingleFriends.Items.Add(fullFriend);
                    }
                    else
                    {
                        listBoxFemaleSingleFriends.Items.Add(fullFriend);
                    }
                }
            }
        }
Exemple #30
0
        public void LoginUser()
        {
            LoginResult result = FacebookService.Login("209512230370639", "user_friends", "user_posts", "user_birthday", "user_gender", "user_likes");

            this.m_LoggedInUser = result.LoggedInUser;
            this.m_accessToken  = result.AccessToken;
        }
Exemple #31
0
        protected override void OnShown(EventArgs i_EventArgs)
        {
            base.OnShown(i_EventArgs);

            AppConfigService appConfig = AppConfigService.GetInstance();

            Top    = appConfig.WindowPosition.X;
            Left   = appConfig.WindowPosition.Y;
            Height = appConfig.WindowHeight;
            Width  = appConfig.WindowWidth;

            try
            {
                if (!string.IsNullOrEmpty(appConfig.LastAccessTocken))
                {
                    LoginResult loginParams = FacebookService.Connect(appConfig.LastAccessTocken);
                    if (loginParams != null)
                    {
                        r_LoginService.LoggedInUser = loginParams.LoggedInUser;
                        postLogin();
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(Resources.ConnectWithTokenErrorMessage, Resources.FacebookConnectionErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #32
0
        public bool CheckLogin(JsonObject ps)
        {
            FacebookService fb = new FacebookService();
            Facebook.JsonObject o = fb.DownloadData<Facebook.JsonObject>("/me", ps["accessToken"].ToString());

            ProfileManager pm = new ProfileManager();
            Profile p = pm.LoadUser(o["email"].ToString());

            if (p != null)
            {
                pm.ReleaseAuthenticationTicket(p);
                return true;
            }
            else
                return false;
        }
 internal FacebookPostsEndpoint(FacebookService service) {
     Service = service;
 }
 internal FacebookAccountsEndpoint(FacebookService service) {
     Service = service;
 }
 internal FacebookFeedEndpoint(FacebookService service) {
     Service = service;
 }
 internal FacebookLikesEndpoint(FacebookService service) {
     Service = service;
 }
 internal FacebookAlbumsEndpoint(FacebookService service) {
     Service = service;
 }
 internal FacebookPhotosEndpoint(FacebookService service) {
     Service = service;
 }
 internal FacebookMethodsEndpoint(FacebookService service) {
     Service = service;
 }
 public FacebookPhotosResponse Next(FacebookService service) {
     return Paging.Next == null ? null : Parse(SocialUtils.DoHttpGetRequestAndGetBodyAsJsonObject(Paging.Next + "&access_token=" + service.AccessToken));
 }
 internal FacebookEventsEndpoint(FacebookService service) {
     Service = service;
 }
 internal FacebookUsersEndpoint(FacebookService service) {
     Service = service;
 }