Hello,
My goal is to transfer a file to DropboxAcc1 to DropboxAcc2 with this API : https://api.dropboxapi.com/2/files/copy_reference/save
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.dropboxapi.com/2/files/copy_reference/get');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $accTemp['access_token'],
'Content-Type: application/json'
));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array('path' => '/stories/' . $post_filename)));
$response = curl_exec($ch);
curl_close($ch);
$responseData = json_decode($response, true);
$copy_reference = $responseData['copy_reference'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.dropboxapi.com/2/files/copy_reference/save');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $token,
'Content-Type: application/json'
));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array('copy_reference' => $copy_reference, 'path' => $path)));
$response = curl_exec($ch);
curl_close($ch);
$responseData = json_decode($response, true);
Everything if i copy a file from DropboxAcc1 to DropboxAcc1 but if i copy to DropboxAcc2 iv got this error :
array(2) {
["error_summary"]=>
string(15) "no_permission/."
["error"]=>
array(1) {
[".tag"]=>
string(13) "no_permission"
}
}
I know problem is because of token but i don't understand how to generate a valid token to transfer to DropboxAcc2 :
I have 2 apps : "DB1app" on DropboxAcc1 and "DB2app" on DropboxAcc2
I successfully generate token with oauth workflow on DB1app (source) and DB2app (target).
I authorized DB1app on DropboxAcc2 aswell
anyone can help please ?
Someone can explain how its works please ?