예제 #1
0
        public ActionResult Confirm()
        {
            _dropBoxClient = (DropBoxClient)Session["dropboxObject"] ?? new DropBoxClient();

            _dropBoxClient.GetAccessToken();

            var apiSecret   = _dropBoxClient.ApiSecret;
            var accessToken = _dropBoxClient.AccessToken;

            var user = _context.Users.GetByUserName(UserName);

            var information = _dropBoxClient.GetInformation();

            var integration = new Integration()
            {
                Name = "Conta - " + information.Name + "(" + information.Email + ")",
                IntegrationSystem = IntegrationSystem.DropBox,
                User     = user,
                Settings = new Dictionary <string, string>()
                {
                    { "apiSecret", apiSecret }, { "accessToken", accessToken }
                }
            };

            _context.Integrations.Add(integration);
            _context.SaveChanges();

            return(RedirectToAction("Index", "Integration"));
        }
예제 #2
0
        public void ShouldGetAccessToken()
        {
            _dropBoxClient = new DropBoxClient();

            var url = _dropBoxClient.GetUrlToRequestToken("");

            _dropBoxClient.GetAccessToken();
        }