cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Discuss Dropbox Developer & API

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

legacy token

legacy token

bspindia
Helpful | Level 7
Go to solution

my token is expiring while making api calls and getting unauthorised error due to short live tokens, how to generate unexpired token 

please assist

regards,

Sikandar

21 Replies 21

ЗГравко
Legendary | Level 20
Go to solution

@bspindia wrote:
...
    curl_setopt($cl,CURLOPT_POSTFIELDS,'{"****my_AppKey******":"***AppSecret*******"}');
...

What's this? :thinking_face: Why it's here? Authentication passes through BASIC authentication or passed as a independent parameter(s) (what's this post parameter that you are posting above actually 🧐). Can you point exact parameter matching in the description?

bspindia
Helpful | Level 7
Go to solution
Hurray made it
 
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.dropbox.com/oauth2/token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=refresh_token&refresh_token=***refreshtoken******");
curl_setopt($ch, CURLOPT_USERPWD, '**AppKey' . ':' . '***AppSecret*****');

$headers = array();
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;
 
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    bspindia Helpful | Level 7
  • User avatar
    ЗГравко Legendary | Level 20
What do Dropbox user levels mean?