Search code examples
apioauthdropboxdropbox-apidropbox-php

Access dropbox api without clientside authentication?


I'm trying to create a smooth solution for sharing files with a custom presentation of the files (logos fonts etc).

My ideal would be to put the files in a dropbox folder and then have a webpage, on a separate server, access those files over javascript and display a list of them linked to the actual files.

A demand is that the end user don't have to authenticate with a dropbox acocunt in order to access the files. I would rather like to use a public folder or use files from another account.

Is there any way to maintain a auth-session serverside, something like a permanent sessionID or something like that?


Solution

  • Just do the authentication one time, approve your app, get your authentication key, and in the code:

    $dbxClient = new dbx\Client($accessToken, "PHP-Example/1.0");
    $accountInfo = $dbxClient->getAccountInfo();
    print_r($accountInfo);
    

    Change:

    $accessToken to "{Your auth key}"
    

    or put the line:

    $accessToken = "{authentication code here}";
    

    above that code.