@@ -7,11 +7,15 @@ var CLIENT_SECRET = '...';
77function run ( ) {
88 var service = getService ( ) ;
99 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 ' ;
1111 var response = UrlFetchApp . fetch ( url , {
1212 headers : {
1313 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 : ''
1519 } ) ;
1620 var result = JSON . parse ( response . getContentText ( ) ) ;
1721 Logger . log ( JSON . stringify ( result , null , 2 ) ) ;
@@ -36,15 +40,15 @@ function reset() {
3640function getService ( ) {
3741 return OAuth2 . createService ( 'Dropbox' )
3842 // 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' )
4145
4246 // Set the client ID and secret.
4347 . setClientId ( CLIENT_ID )
4448 . setClientSecret ( CLIENT_SECRET )
4549
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.
4852 . setCallbackFunction ( 'authCallback' )
4953
5054 // Set the property store where authorized tokens should be persisted.
0 commit comments