Dropbox
Dropbox copied to clipboard
Forbidden error
I'm getting a forbidden error when I run the example putFile. I can run accountInfo without any issue. I just switched over to use the database to store the tokens. I was able to write the files before the change but now I get the forbidden error. Here is the actual error dump:
Fatal error: Uncaught exception 'Dropbox\Exception' with message 'Forbidden' in E:\web\relaytra\EBARR\NewTest\Dropbox\OAuth\Consumer\Curl.php:153 Stack trace: #0 E:\web\relaytra\EBARR\NewTest\Dropbox\API.php(495): Dropbox\OAuth\Consumer\Curl->fetch('POST', 'https://api-con...', 'files/sandbox/', Array) #1 E:\web\relaytra\EBARR\NewTest\Dropbox\API.php(110): Dropbox\API->fetch('POST', 'https://api-con...', 'files/sandbox/', Array) #2 E:\web\relaytra\EBARR\NewTest\examples\putFile.php(19): Dropbox\API->putFile('C:\Windows\Temp...', 'api_upload_test...') #3 {main} thrown in E:\web\relaytra\EBARR\NewTest\Dropbox\OAuth\Consumer\Curl.php on line 153
Any idea what I have wrong?
Also should the userId match the one from the accountinfo? My userId is 1.
Thanks!
Hi @adabie
Sorry for the delay in getting back to you. Are you still experiencing this problem? I've not seen it before so I'll need some time to look into it.
Regarding user ID: The ID passed to the storage handler should be your internal user ID (should match the ID used in your users table, for example). Hope this helps.
Hi,
I found my issue. I needed to switch from using the 'sandbox' to using 'dropbox' for my access type. My app doesn't write to the app folder. It's working now.
Thanks!
@adabie how to switch from sandbox to dropbox ? im also facing the same issue
HI @sureshdsk
Either pass 'dropbox' as the second argument when instantiating the Dropbox\API object, or call Dropbox\API::setRoot(), passing 'dropbox' as the only argument.