Answer the question
In order to leave comments, you need to log in
How to get access_token in Dropbox?
I'm trying to use the Dropbox OAuth API, I get only the auth_token, but it's not clear how to convert it to an access_token for a permanent connection (without curl).
Answer the question
In order to leave comments, you need to log in
Judging by the documentation, something like this (if without cURL):
$context = stream_context_create(array('http' => array(
'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded\r\n".
"Authorization: Basic ".base64_encode("<app key>:<app secret>")."\r\n",
'content' => http_build_query(array(
'code' => <authorization code>,
'grant_type' => 'authorization_code',
'redirect_uri' => <redirect URI>,
)),
)));
$url = 'https://api.dropbox.com/1/oauth2/token';
$result = file_get_contents($url, false, $context);
$result_json = json_decode($result);
echo $result_json->access_token;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question