cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Uploading localhost mysql.sql file uploading problems

Uploading localhost mysql.sql file uploading problems

derickbarthelot
New member | Level 2

I have an problem with Dropbox api. I successfully installed and checked PHP all are ok. but every time connection asking the access token. I need to upload without any questions ask dirrectly upload file and download if needs. 

 

Every time i need to follow these steps to get upload the file...... copy the token and past into $authCode.

 

$authorizeUrl = $webAuth->start();
echo "1. Go to: " . $authorizeUrl . "<br>";
echo "2. Click \"Allow\" (you might have to log in first).<br>";
echo "3. Copy the authorization code and insert it into authCode.<br>";
$authCode = trim('A23fdddsefsersfSFDSFd1BhBaikCob6bFDxkNSU');

list($accessToken, $dropboxUserId) = $webAuth->finish($authCode);
echo "Access Token: " . $accessToken . "<br>";

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

1 Reply 1

Steve M.
Dropbox Staff

You only need to obtain the access token once.

 

It looks like your code echos the access token, so just copy that (or get a token by clicking the "generate token" button on the app console) and then change your code to just this:

 

$accessToken = "<the token you obtained>";
$dbxClient = new dbx\Client($accessToken, "PHP-Example/1.0");

(Everything else in the code snippet you shared can be deleted or commented out, since you don't need to do it once you already have an access token.)

Need more support?