Dropbox icon indicating copy to clipboard operation
Dropbox copied to clipboard

How to set to the userID dynamically for each user?

Open broakenmedia opened this issue 11 years ago • 1 comments

I have a login system, from which i'd like to insert when the user registers, their 'user_id' into the userID for the dropbox table? a foreign key of sorts?

Is this possible? seems to be hardcoded as 1?

broakenmedia avatar Jan 26 '14 21:01 broakenmedia

Hi @xbroak

Apologies, you've probably resolved this by now, but I thought I'd reply instead of just closing the ticket. The library is authentication system agnostic. When a user registers, you'd retrieve a Dropbox access token for them, taking them through the OAuth flow, and then store it for their user ID. The only thing you'd need to do is retrieve their user ID from your users table and pass it to the storage handler when you create it e.g.

$userID = $loggedInUser->user_id;
$storage = new \Dropbox\OAuth\Storage\PDO($encrypter, $userID);

Hope this helps someone :)

BenExile avatar Aug 05 '14 10:08 BenExile