Forum Discussion

SAFCLiam's avatar
SAFCLiam
New member | Level 2
6 years ago

PHP Login with Dropbox issues.

Hello, im following the guide on how to use the APIs so my app can use Login with Dropbox. But im having issues getting a token.

This is my code to see why im getting the following error.

<?php

$request = new HttpRequest();
$request->setUrl('https://api.dropboxapi.com/2/auth/token/from_oauth1');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'postman-token' => '273abf8c-7816-67c2-0949-f24bfc57383c',
  'cache-control' => 'no-cache',
  'content-type' => 'application/json',
  'authorization' => 'Basic m1qbv920v0xwxlm:xxxxxx'
));

$request->setBody('{
    "oauth1_token": "m1qbv920v0xwxlm",
    "oauth1_token_secret": "xxxxx"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

This is the error.

{
    "error_summary": "invalid_oauth1_token_info/.",
    "error": {
        ".tag": "invalid_oauth1_token_info"
    }
}
  • The specific /2/auth/token/from_oauth1 endpoint you're using is only be for migrating legacy OAuth 1 access tokens to OAuth 2. If you're just building your app now, you wouldn't have any OAuth 1 access tokens so you wouldn't need to use that endpoint.


    The full documentation for the Dropbox OAuth endpoints can be found here. Another helpful resource is our OAuth developer guide

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 5 hours ago
351 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!