spatie / flysystem-dropbox

A flysystem driver for Dropbox that uses the v2 API
https://freek.dev/734-dropbox-will-turn-off-v1-of-their-api-soon-its-time-to-update-your-php-application
MIT License
342 stars 50 forks source link

use token per User #48

Closed arce701 closed 5 years ago

arce701 commented 5 years ago

Good day, sorry for writing here, I need to save the dropbox tokens in a database for each user, so that when the logged user uploads a file it is saved in his personal dropbox. Some advice or example I would appreciate very much.

atymic commented 5 years ago

Just pass it when creating the dropbox client:


use League\Flysystem\Filesystem;
use Spatie\Dropbox\Client;
use Spatie\FlysystemDropbox\DropboxAdapter;

$client = new Client($user->dropbox_token); // for example

$adapter = new DropboxAdapter($client);

$filesystem = new Filesystem($adapter);