Пример #1
0
        public async Task <AccountConfiguration> CreateAccount()
        {
            var isOk = OAuth2Flow.TryAuthenticate(this);

            if (!isOk)
            {
                return(null);
            }

            var hubicAccount = await HubiCHelper.GetAccountAsync(_token.AccessToken);

            var account = new AccountConfiguration()
            {
                Type   = StorageType.HubiC,
                Id     = hubicAccount.EMail,
                Name   = string.Format("{0} {1}", hubicAccount.FirstName, hubicAccount.LastName),
                Secret = _token.RefreshToken,
            };

            return(account);
        }
        public async Task <AccountConfiguration> CreateAccount()
        {
            var isOk = OAuth2Flow.TryAuthenticate(this);

            if (!isOk)
            {
                return(null);
            }

            var profile = await _api.Profile.GetProfile();

            var account = new AccountConfiguration()
            {
                Id     = profile.user_id,
                Name   = profile.name,
                Type   = StorageType.AmazonDrive,
                Secret = _token.RefreshToken,
            };

            return(account);
        }
Пример #3
0
        public async Task <AccountConfiguration> CreateAccount()
        {
            var isOk = OAuth2Flow.TryAuthenticate(this);

            if (!isOk)
            {
                return(null);
            }

            var api   = DropboxHelper.GetApi(_oauthResponse.AccessToken);
            var owner = await api.Users.GetCurrentAccountAsync();

            var account = new AccountConfiguration()
            {
                Id     = owner.AccountId,
                Name   = owner.Name.DisplayName,
                Type   = _isAccessRestricted ? StorageType.DropboxRestricted : StorageType.Dropbox,
                Secret = _oauthResponse.AccessToken,
            };

            return(account);
        }
Пример #4
0
        public async Task <AccountConfiguration> CreateAccount()
        {
            _api = new OneDriveConsumerApi(OneDriveHelper.OneDriveClientId, OneDriveHelper.OneDriveClientSecret);

            var isOk = OAuth2Flow.TryAuthenticate(this);

            if (!isOk)
            {
                return(null);
            }

            var drive = await _api.GetDrive();

            var account = new AccountConfiguration
            {
                Type   = StorageType.OneDrive,
                Name   = drive.Owner.User.DisplayName,
                Id     = drive.Id,
                Secret = _api.AccessToken.RefreshToken
            };


            return(account);
        }