Dear all, is oauth 1.0 still use in the future? That's means use API V2 and use oauth 1.0 through HTTP, TKS!
Thanks for your answer. and I have another question about API V2 oauth 2.0.
I use c++ code to upload files, but how can I get access token by http request with API V2 , eg:
https://www.dropbox.com/oauth2/authorize
https://api.dropboxapi.com/oauth2/token
c++ code :
#include <stdio.h>#include <curl/curl.h>int main (int argc, char *argv[]){ CURL *curl; CURLcode res; /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); /* get a curl handle */ curl = curl_easy_init(); if(curl) { printf ("Running curl test.\n"); struct curl_slist *headers=NULL; /* init to NULL is important */ headers = curl_slist_append(headers, "Authorization: Bearer <ACCESS_TOKEN>"); headers = curl_slist_append(headers, "Content-Type: application/octet-stream"); headers = curl_slist_append(headers, "Dropbox-API-Arg: {\"path\":\"/test_c++_upload_test.txt\"}"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_URL, "https://content.dropboxapi.com/2/files/upload"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "test data for upload"); /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); /* always cleanup */ curl_easy_cleanup(curl); printf ("\nFinished curl test.\n"); } curl_global_cleanup(); printf ("Done!\n"); return 0;}
You can find information on how the OAuth app authorization flow works here:https://www.dropbox.com/developers/reference/oauth-guideThe documentation for the specific endpoints you need to use can be found here:https://www.dropbox.com/developers/documentation/http/documentation#authorizationYou can use either the "token" or "code" flow, depending on what makes sense for your app. Note that https://www.dropbox.com/oauth2/authorize is a web page, not an API endpoint. Your app should direct users there in their browser, and not make any API calls to it directly. The https://api.dropboxapi.com/oauth2/token URI is an API endpoint that you would use if you use the OAuth 2 "code" flow.If you run in to any issues implementing that, please let us know the steps to reproduce the issue, and share the relevant code and output so we can look into it.
Many thanks your answer! and I've read the the URL doc, but I have a puzzle when I use browse to get token.
https://www.dropbox.com/oauth2/authorize?client_id=0lksd9ebhsil1qx?response_type=(when can I get the string?). the browse show 400 error with message:
0lksd9ebhsil1qx
More details for developers
Invalid client_id: "0lksd9ebhsil1qx?response_type=".
Thank you for your answer! and I can get authorization code by browser. then I use https://api.dropboxapi.com/oauth2/token API to get correct result . but that's not my needed.
and I don't understand what's the different between https://api.dropboxapi.com/oauth2/token result "access_token" and App Console (Generated access token) .
in fact, I want to the user input App key and App secret . then I can use API V2 to get access token , and I can upload files. if let's user input access token, it too long and inconvenient . so please help me. thanks!