0
IonicとCordovaを使用してアプリケーションを構築しようとしていますが、その機能の一部は安全な場所からファイルをアップロードしてダウンロードし、 ユーザー:pass方法で、私の資格を入れている間にカールを使って作業していますが、私は$ cordovaFileTransferを使用しています。
私の質問は、ファイルをアップロードしてダウンロードするために認証が必要であることを知っていることです。
、ここでは私のためのコードです:
document.addEventListener('deviceready', function() {
var url = "https://serverlink/thing.txt";
var targetPath = cordova.file.externalRootDirectory + "/cloud/thing.txt";
var trustHosts = true;
var options = {
params: {
// Do i put my credentials here ??
}
};
console.log('before download');
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
.then(function(result) {
// Success!
console.log("done downloading the file");
}, function(err) {
// Error
console.log('error yaw !!', err);
}, function(progress) {
$timeout(function() {
$scope.downloadProgress = (progress.loaded/progress.total) * 100;
});
});
}, false);
だから、私はオプションのオブジェクト内の私の資格情報のparamsを置く場所上記のコードをテストしたが、その動作していません。