@@ -7,11 +7,15 @@ var CLIENT_SECRET = '...';
7
7
function run ( ) {
8
8
var service = getService ( ) ;
9
9
if ( service . hasAccess ( ) ) {
10
- var url = 'https://api.dropboxapi.com/1/account/info ' ;
10
+ var url = 'https://api.dropboxapi.com/2/users/get_current_account ' ;
11
11
var response = UrlFetchApp . fetch ( url , {
12
12
headers : {
13
13
Authorization : 'Bearer ' + service . getAccessToken ( )
14
- }
14
+ } ,
15
+ method : 'post' ,
16
+ // The Content-Type header must be set to an empty string when passing no
17
+ // JSON payload.
18
+ contentType : ''
15
19
} ) ;
16
20
var result = JSON . parse ( response . getContentText ( ) ) ;
17
21
Logger . log ( JSON . stringify ( result , null , 2 ) ) ;
@@ -36,15 +40,15 @@ function reset() {
36
40
function getService ( ) {
37
41
return OAuth2 . createService ( 'Dropbox' )
38
42
// Set the endpoint URLs.
39
- . setAuthorizationBaseUrl ( 'https://www.dropbox.com/1/ oauth2/authorize' )
40
- . setTokenUrl ( 'https://api.dropboxapi.com/1/ oauth2/token' )
43
+ . setAuthorizationBaseUrl ( 'https://www.dropbox.com/oauth2/authorize' )
44
+ . setTokenUrl ( 'https://api.dropboxapi.com/oauth2/token' )
41
45
42
46
// Set the client ID and secret.
43
47
. setClientId ( CLIENT_ID )
44
48
. setClientSecret ( CLIENT_SECRET )
45
49
46
- // Set the name of the callback function that should be invoked to complete
47
- // the OAuth flow.
50
+ // Set the name of the callback function that should be invoked to
51
+ // complete the OAuth flow.
48
52
. setCallbackFunction ( 'authCallback' )
49
53
50
54
// Set the property store where authorized tokens should be persisted.
0 commit comments