summaryrefslogtreecommitdiff
path: root/0001-Revert-tdf-101630-gdrive-support-w-oAuth-and-Drive-A.patch
blob: 23990264e6b3cf5954d63b2d06dd66ff89c3c223 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
From 12f14a6c9d2b5034df53646bbc57774c0c83ecaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 3 Sep 2021 09:13:03 +0100
Subject: [PATCH] Revert "tdf#101630 - gdrive support w/oAuth and Drive API v3"

This reverts commit 854c03ebc94aae205b85d0c9d342048baf93e9a9.
---
 Repository.mk                                 |   2 +-
 config_host/config_oauth2.h.in                |   8 +-
 external/libcmis/UnpackedTarball_libcmis.mk   |   2 -
 external/libcmis/libcmis_gdrive.patch.1       | 702 ------------------
 .../libcmis_oauth_pw_as_refreshtoken.patch.1  | 185 -----
 .../data/org/openoffice/Office/Common.xcu     |   2 +-
 ucb/source/ucp/cmis/auth_provider.cxx         | 130 +---
 ucb/source/ucp/cmis/auth_provider.hxx         |   8 +-
 ucb/source/ucp/cmis/cmis_content.cxx          |  21 +-
 ucb/source/ucp/cmis/cmis_repo_content.cxx     |   4 +-
 10 files changed, 56 insertions(+), 1008 deletions(-)
 delete mode 100644 external/libcmis/libcmis_gdrive.patch.1
 delete mode 100644 external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1

diff --git a/Repository.mk b/Repository.mk
index 23c268775fcf..c887d9b4297d 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -432,7 +432,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	ucpexpand1 \
 	ucpext \
 	ucpimage \
-	$(if $(ENABLE_LIBCMIS),ucpcmis1) \
+	ucpcmis1 \
 	ucptdoc1 \
 	unordf \
 	unoxml \
diff --git a/config_host/config_oauth2.h.in b/config_host/config_oauth2.h.in
index 9945dda3dda5..a95015b41f3e 100644
--- a/config_host/config_oauth2.h.in
+++ b/config_host/config_oauth2.h.in
@@ -15,13 +15,13 @@
 
 
 /* Google Drive settings */
-#define GDRIVE_BASE_URL "https://www.googleapis.com/drive/v3"
+#define GDRIVE_BASE_URL "https://www.googleapis.com/drive/v2"
 #define GDRIVE_CLIENT_ID ""
 #define GDRIVE_CLIENT_SECRET ""
-#define GDRIVE_AUTH_URL "https://accounts.google.com/o/oauth2/v2/auth"
-#define GDRIVE_TOKEN_URL "https://oauth2.googleapis.com/token"
+#define GDRIVE_AUTH_URL "https://accounts.google.com/o/oauth2/auth"
+#define GDRIVE_TOKEN_URL "https://accounts.google.com/o/oauth2/token"
 #define GDRIVE_REDIRECT_URI "urn:ietf:wg:oauth:2.0:oob"
-#define GDRIVE_SCOPE "https://www.googleapis.com/auth/drive.file"
+#define GDRIVE_SCOPE "https://www.googleapis.com/auth/drive"
 
 
 /* Alfresco Cloud */
diff --git a/external/libcmis/UnpackedTarball_libcmis.mk b/external/libcmis/UnpackedTarball_libcmis.mk
index 8398853e4511..a5be3078c95a 100644
--- a/external/libcmis/UnpackedTarball_libcmis.mk
+++ b/external/libcmis/UnpackedTarball_libcmis.mk
@@ -17,8 +17,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,libcmis, \
 	external/libcmis/libcmis-libxml2_compatibility.patch \
 	external/libcmis/0001-rename-class-GetObject-to-avoid-name-clash-on-Window.patch \
 	external/libcmis/libcmis_onedrive.patch \
-	external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1 \
-	external/libcmis/libcmis_gdrive.patch.1 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/libcmis/libcmis_gdrive.patch.1 b/external/libcmis/libcmis_gdrive.patch.1
deleted file mode 100644
index 24ff65d1ef15..000000000000
--- a/external/libcmis/libcmis_gdrive.patch.1
+++ /dev/null
@@ -1,702 +0,0 @@
-diff -ur libcmis.org/src/libcmis/gdrive-document.cxx libcmis/src/libcmis/gdrive-document.cxx
---- libcmis.org/src/libcmis/gdrive-document.cxx	2021-07-27 19:11:02.679247008 +0200
-+++ libcmis/src/libcmis/gdrive-document.cxx	2021-07-27 19:11:18.873246420 +0200
-@@ -145,23 +145,17 @@
- {
-     if ( !os.get( ) )
-         throw libcmis::Exception( "Missing stream" );
--    if ( !isImmutable( ) )
--        throw libcmis::Exception( string ( "Document " + getId( )+ 
--                                    " is not editable" ) );
--    string putUrl = getUploadUrl( ) + getId( );
--    putUrl += "?uploadType=media";
--    
--    // If it's a Google document, convert it 
--    if ( isGoogleDoc( ) )
--        putUrl  += "&convert=true";
-+
-+    string putUrl = GDRIVE_UPLOAD_LINK + getId( ) + "?uploadType=media";
- 
-     // Upload stream
-     boost::shared_ptr< istream> is ( new istream ( os->rdbuf( ) ) );
-     vector <string> headers;
-     headers.push_back( string( "Content-Type: " ) + contentType );
-+    string res;
-     try
-     {
--        getSession()->httpPutRequest( putUrl, *is, headers );
-+        res = getSession()->httpPatchRequest( putUrl, *is, headers )->getStream()->str();
-     }
-     catch ( const CurlException& e )
-     {
-@@ -181,35 +175,10 @@
- {
-     if ( !os.get( ) )
-         throw libcmis::Exception( "Missing stream" );
--    
--    if ( !isImmutable( ) )
--        throw libcmis::Exception( string ( "Document " + getId( )+ 
--                                    " is not editable" ) );
--    string metaUrl = getUrl( );
--
--    // If it's a Google document, convert it 
--    if ( isGoogleDoc( ) )
--        metaUrl += "?convert=true";
--
--    // Update file name meta information
--    if ( !fileName.empty( ) && fileName != getContentFilename( ) )
--    {
--        Json metaJson;
--        Json fileJson( fileName.c_str( ) );
--        metaJson.add("title", fileJson );
--
--        std::istringstream is( metaJson.toString( ) );
--        vector<string> headers;
--        headers.push_back( "Content-Type: application/json" );
--        try
--        {
--            getSession()->httpPutRequest( metaUrl, is, headers );
--        }
--        catch ( const CurlException& e )
--        {
--            throw e.getCmisException( );
--        }
--    }
-+
-+    // TODO: when would the filename need an update?
-+    if (!fileName.empty() && fileName != getContentFilename())
-+        std::cout << "filename change is not implemented in setContentStream" << std::endl;
- 
-     // Upload stream
-     uploadStream( os, contentType );
-@@ -251,7 +220,7 @@
- vector< libcmis::DocumentPtr > GDriveDocument::getAllVersions( ) 
- {   
-     vector< libcmis::DocumentPtr > revisions;
--    string versionUrl = getUrl( ) + "/revisions";
-+    string versionUrl = GDRIVE_METADATA_LINK + getId( ) + "/revisions";
-     // Run the http request to get the properties definition
-     string res;
-     try
-@@ -263,7 +232,7 @@
-         throw e.getCmisException( );
-     }
-     Json jsonRes = Json::parse( res );        
--    Json::JsonVector objs = jsonRes["items"].getList( );
-+    Json::JsonVector objs = jsonRes["revisions"].getList( );
-    
-     string parentId = getStringProperty( "cmis:parentId" );
- 
-diff -ur libcmis.org/src/libcmis/gdrive-folder.cxx libcmis/src/libcmis/gdrive-folder.cxx
---- libcmis.org/src/libcmis/gdrive-folder.cxx	2021-07-27 19:11:02.678247008 +0200
-+++ libcmis/src/libcmis/gdrive-folder.cxx	2021-07-27 19:11:18.874246420 +0200
-@@ -62,8 +62,8 @@
-     // Instead of sending multiple queries for children,
-     // we send a single query to search for objects where parents
-     // include the folderID.
--    string query = getSession( )->getBindingUrl( ) + 
--        "/files?q=\"" + getId( ) + "\"+in+parents+and+trashed+=+false";
-+    string query = GDRIVE_METADATA_LINK + "?q=\"" + getId( ) + "\"+in+parents+and+trashed+=+false" +
-+        "&fields=files(kind,id,name,parents,mimeType,createdTime,modifiedTime,thumbnailLink,size)";
- 
-     string res;
-     try
-@@ -76,7 +76,7 @@
-     }
- 
-     Json jsonRes = Json::parse( res );
--    Json::JsonVector objs = jsonRes["items"].getList( );
-+    Json::JsonVector objs = jsonRes["files"].getList( );
-     
-     // Create children objects from Json objects
-     for(unsigned int i = 0; i < objs.size(); i++)
-@@ -95,7 +95,7 @@
- string GDriveFolder::uploadProperties( Json properties )
- {
-     // URL for uploading meta data
--    string metaUrl =  getSession()->getBindingUrl() + "/files/";
-+    string metaUrl =  GDRIVE_METADATA_LINK + "?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime";
- 
-     // add parents to the properties    
-     properties.add( "parents", GdriveUtils::createJsonFromParentId( getId( ) ) );
-@@ -147,9 +147,15 @@
-     
-     Json propsJson = GdriveUtils::toGdriveJson( properties );
- 
--    // Add filename to properties
--    Json jsonFilename( fileName.c_str( ) );
--    propsJson.add( "title", jsonFilename );
-+    if(!fileName.empty()) {
-+        // use provided filename
-+        Json jsonFilename( fileName.c_str( ) );
-+
-+        propsJson.add( "name", jsonFilename );
-+    }
-+    if(!contentType.empty()) {
-+        propsJson.add( "mimeType", Json(contentType.c_str()));
-+    }
-     
-     // Upload meta-datas
-     string res = uploadProperties( propsJson);
-@@ -171,12 +177,9 @@
-     libcmis::UnfileObjects::Type /*unfile*/, 
-     bool /*continueOnError*/ ) 
- {
--    // Object remove doesn't work with folder
--    // Using trash instead
-     try
-     {   
--        istringstream is( "" );
--        getSession( )->httpPostRequest( getUrl( ) + "/trash", is, "" );
-+        getSession( )->httpDeleteRequest( GDRIVE_METADATA_LINK + getId( ) );
-     }
-     catch ( const CurlException& e )
-     {
-diff -ur libcmis.org/src/libcmis/gdrive-object.cxx libcmis/src/libcmis/gdrive-object.cxx
---- libcmis.org/src/libcmis/gdrive-object.cxx	2021-07-27 19:11:02.675247009 +0200
-+++ libcmis/src/libcmis/gdrive-object.cxx	2021-07-27 19:11:18.874246420 +0200
-@@ -89,8 +89,8 @@
-             property.reset( new GDriveProperty( it->first, it->second ) );
-             m_properties[ property->getPropertyType( )->getId()] = property;
-            
--            // we map "title" to both "cmis:name" and "cmis:getContentStreamFileName"
--            if ( it->first == "title" )
-+            // we map "name" to both "cmis:name" and "cmis:getContentStreamFileName"
-+            if ( it->first == "name" )
-             {
-                 property.reset( new GDriveProperty( "cmis:name", it->second) );
-                 m_properties[ property->getPropertyType( )->getId()] = property;
-@@ -142,16 +142,13 @@
- {
-     if ( m_renditions.empty( ) )
-     {
--        string downloadUrl = getStringProperty( "downloadUrl" );
--        if ( !downloadUrl.empty( ) )
--        {
--            string mimeType = getStringProperty( "cmis:contentStreamMimeType" );
--            if ( !mimeType.empty( ) )
--            { 
--                RenditionPtr rendition( 
--                    new Rendition( mimeType, mimeType, mimeType, downloadUrl ));
--                m_renditions.push_back( rendition );
--            }
-+        string downloadUrl = GDRIVE_METADATA_LINK + getId( ) + "?alt=media";
-+        string mimeType = getStringProperty( "cmis:contentStreamMimeType" );
-+        if ( !mimeType.empty( ) )
-+        {
-+            RenditionPtr rendition(
-+                new Rendition( mimeType, mimeType, mimeType, downloadUrl ));
-+            m_renditions.push_back( rendition );
-         }
- 
-         vector< string > exportLinks = getMultiStringProperty( "exportLinks" );
-@@ -192,7 +189,7 @@
-     {   
-         vector< string > headers;
-         headers.push_back( "Content-Type: application/json" );
--        response = getSession( )->httpPutRequest( getUrl( ), is, headers );
-+        response = getSession( )->httpPatchRequest( getUrl( ), is, headers );
-     }
-     catch ( const CurlException& e )
-     {   
-@@ -228,7 +225,7 @@
- {
-     try
-     {
--        getSession( )->httpDeleteRequest( getUrl( ) );
-+        getSession( )->httpDeleteRequest( GDRIVE_METADATA_LINK + getId( ) );
-     }
-     catch ( const CurlException& e )
-     {
-@@ -239,8 +236,8 @@
- void GDriveObject::move( FolderPtr /*source*/, FolderPtr destination ) 
- {  
-     Json parentsJson;
--    Json parentsValue = GdriveUtils::createJsonFromParentId( destination->getId( ) );
--    parentsJson.add( "parents", parentsValue );
-+    parentsJson.add( "addParents", Json(destination->getId( ).c_str()) );
-+    parentsJson.add( "removeParents", Json(getStringProperty( "cmis:parentId" ).c_str()) );
-     
-     istringstream is( parentsJson.toString( ) );
-     libcmis::HttpResponsePtr response;
-@@ -248,7 +245,7 @@
-     {   
-         vector< string > headers;
-         headers.push_back( "Content-Type: application/json" );
--        response = getSession( )->httpPutRequest( getUrl( ), is, headers );
-+        response = getSession( )->httpPatchRequest( getUrl( ), is, headers );
-     }
-     catch ( const CurlException& e )
-     {   
-@@ -262,12 +259,10 @@
- 
- string GDriveObject::getUrl( )
- {
--    return getSession( )->getBindingUrl( ) + "/files/" + getId( );
--}
--
--string GDriveObject::getUploadUrl( )
--{
--    return GDRIVE_UPLOAD_LINKS;
-+    // thumbnailLink causes some operations to fail with internal server error,
-+    // see https://issuetracker.google.com/issues/36760667
-+    return GDRIVE_METADATA_LINK + getId( ) +
-+                "?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime,size";
- }
- 
- vector< string> GDriveObject::getMultiStringProperty( const string& propertyName )
-diff -ur libcmis.org/src/libcmis/gdrive-repository.cxx libcmis/src/libcmis/gdrive-repository.cxx
---- libcmis.org/src/libcmis/gdrive-repository.cxx	2021-07-27 19:11:02.676247009 +0200
-+++ libcmis/src/libcmis/gdrive-repository.cxx	2021-07-27 19:11:18.874246420 +0200
-@@ -35,7 +35,7 @@
-     m_name = "Google Drive";
-     m_description = "Google Drive repository";
-     m_productName = "Google Drive";
--    m_productVersion = "v2";
-+    m_productVersion = "v3";
-     m_rootId = "root";
-  
-     m_capabilities[ ACL ] = "discover";
-diff -ur libcmis.org/src/libcmis/gdrive-session.cxx libcmis/src/libcmis/gdrive-session.cxx
---- libcmis.org/src/libcmis/gdrive-session.cxx	2021-07-27 19:11:02.675247009 +0200
-+++ libcmis/src/libcmis/gdrive-session.cxx	2021-07-27 19:11:18.874246420 +0200
-@@ -124,9 +124,13 @@
- 
- libcmis::ObjectPtr GDriveSession::getObject( string objectId )
- {
-+    if(objectId == "root") {
-+        return getRootFolder();
-+    }
-     // Run the http request to get the properties definition
-     string res;
--    string objectLink = m_bindingUrl + "/files/" + objectId;
-+    string objectLink = GDRIVE_METADATA_LINK + objectId +
-+         "?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime,thumbnailLink,size";
-     try
-     {
-         res = httpGetRequest( objectLink )->getStream()->str();
-@@ -188,9 +192,10 @@
-         {
-             // Normal child case
-             // Ask for the ID of the child if there is any
--            string childIdUrl = m_bindingUrl + "/files/" + objectId +
--                                "/children/?q=title+=+'" + segment +
--                                "'&fields=items:id";
-+            // somewhat flawed as names are not necessarily unique in GDrive...
-+            string query = libcmis::escape("'" + objectId + "' in parents and trashed = false and name='" + segment + "'");
-+
-+            string childIdUrl = m_bindingUrl + "/files/?q=" + query + "&fields=files(id)";
- 
-             string res;
-             try
-@@ -204,7 +209,7 @@
-             Json jsonRes = Json::parse( res );
- 
-             // Did we get an id?
--            Json::JsonVector items = jsonRes["items"].getList();
-+            Json::JsonVector items = jsonRes["files"].getList();
-             if ( items.empty( ) )
-                 throw libcmis::Exception( "Object not found: " + path, "objectNotFound" );
- 
-@@ -219,6 +224,27 @@
-     return getObject( objectId );
- }
- 
-+libcmis::FolderPtr GDriveSession::getRootFolder()
-+{
-+    // permissions/scope with just drive.file don't allow to get it with the "root" alias/by its actual object-ID
-+    Json propsJson;
-+
-+    // GDrive folder is a file with a different mime type.
-+    string mimeType = GDRIVE_FOLDER_MIME_TYPE;
-+
-+    // Add mimetype to the propsJson
-+    Json jsonMimeType( mimeType.c_str( ) );
-+    propsJson.add( "mimeType", jsonMimeType );
-+    propsJson.add( "id", "root" );
-+
-+    // Upload meta-datas
-+    propsJson.add("cmis:name", "VirtualRoot");
-+
-+    libcmis::FolderPtr folderPtr( new GDriveFolder( this, propsJson ) );
-+
-+    return folderPtr;
-+}
-+
- libcmis::ObjectTypePtr GDriveSession::getType( string id )
- {
-     libcmis::ObjectTypePtr type( new GdriveObjectType( id ) );
-diff -ur libcmis.org/src/libcmis/gdrive-session.hxx libcmis/src/libcmis/gdrive-session.hxx
---- libcmis.org/src/libcmis/gdrive-session.hxx	2021-07-27 19:11:02.675247009 +0200
-+++ libcmis/src/libcmis/gdrive-session.hxx	2021-07-27 19:11:18.875246420 +0200
-@@ -57,6 +57,8 @@
- 
-         virtual std::vector< libcmis::ObjectTypePtr > getBaseTypes( );
- 
-+        virtual libcmis::FolderPtr getRootFolder();
-+
-         virtual std::string getRefreshToken();
- 
-     private:
-diff -ur libcmis.org/src/libcmis/gdrive-utils.cxx libcmis/src/libcmis/gdrive-utils.cxx
---- libcmis.org/src/libcmis/gdrive-utils.cxx	2021-07-27 19:11:02.677247008 +0200
-+++ libcmis/src/libcmis/gdrive-utils.cxx	2021-07-27 19:11:18.875246420 +0200
-@@ -44,17 +44,17 @@
-         convertedKey = "cmis:createdBy";
-     else if ( key == "description" )
-         convertedKey = "cmis:description";
--    else if ( key == "createdDate" )
-+    else if ( key == "createdTime" )
-         convertedKey = "cmis:creationDate";
-     else if ( key == "lastModifyingUserName" )
-         convertedKey = "cmis:lastModifiedBy";
--    else if ( key == "modifiedDate" )
-+    else if ( key == "modifiedTime" )
-         convertedKey = "cmis:lastModificationDate";
--    else if ( key == "title" )
-+    else if ( key == "name" )
-         convertedKey = "cmis:contentStreamFileName";
-     else if ( key == "mimeType" )
-         convertedKey = "cmis:contentStreamMimeType";
--    else if ( key == "fileSize" )
-+    else if ( key == "size" )
-         convertedKey = "cmis:contentStreamLength";
-     else if ( key == "editable" )
-         convertedKey = "cmis:isImmutable";
-@@ -72,21 +72,21 @@
-     else if ( key == "cmis:createdBy" )
-         convertedKey = "ownerNames";
-     else if ( key == "cmis:creationDate" )
--        convertedKey = "createdDate";
-+        convertedKey = "createdTime";
-     else if ( key == "cmis:description" )
-         convertedKey = "description";
-     else if ( key == "cmis:lastModifiedBy" )
-         convertedKey = "lastModifyingUserName";
-     else if ( key == "cmis:lastModificationDate" )
--        convertedKey = "modifiedDate";
-+        convertedKey = "modifiedTime";
-     else if ( key == "cmis:contentStreamFileName" )
--        convertedKey = "title";
-+        convertedKey = "name";
-     else if ( key == "cmis:name" )
--        convertedKey = "title";
-+        convertedKey = "name";
-     else if ( key == "cmis:contentStreamMimeType" )
-         convertedKey = "mimeType";
-     else if ( key == "cmis:contentStreamLength" )
--        convertedKey = "fileSize";
-+        convertedKey = "size";
-     else if ( key == "cmis:isImmutable" )
-         convertedKey = "editable";
-     else if ( key == "cmis:parentId" )
-@@ -124,9 +124,9 @@
- bool GdriveUtils::checkUpdatable( const string& key )
- {
-     // taken from https://developers.google.com/drive/v2/reference/files
--    bool updatable = ( key == "title" ||
-+    bool updatable = ( key == "name" ||
-                   key == "description" ||
--                  key == "modifiedDate" ||
-+                  key == "modifiedTime" ||
-                   key == "lastViewedByMeDate" );
-     return updatable;    
- }
-@@ -143,18 +143,11 @@
- 
- Json GdriveUtils::createJsonFromParentId( const string& parentId )
- {
--    Json parentValue( parentId.c_str( ) );
--    
-     // parents is a Json array
-     Json firstParent;
--    firstParent.add( "id", parentValue );
--    
--    Json::JsonVector parents;
--    parents.insert( parents.begin( ), firstParent );
-+    firstParent.add( Json( parentId.c_str() ) );
-     
--    Json parentsValue( parents );
--
--    return parentsValue;
-+    return firstParent;
- }
- 
- vector< string > GdriveUtils::parseGdriveProperty( string key, Json json )
-diff -ur libcmis.org/src/libcmis/gdrive-utils.hxx libcmis/src/libcmis/gdrive-utils.hxx
---- libcmis.org/src/libcmis/gdrive-utils.hxx	2021-07-27 19:11:02.677247008 +0200
-+++ libcmis/src/libcmis/gdrive-utils.hxx	2021-07-27 19:11:18.875246420 +0200
-@@ -35,7 +35,8 @@
- #include "json-utils.hxx"
- 
- static const std::string GDRIVE_FOLDER_MIME_TYPE = "application/vnd.google-apps.folder" ;
--static const std::string GDRIVE_UPLOAD_LINKS = "https://www.googleapis.com/upload/drive/v2/files/";
-+static const std::string GDRIVE_UPLOAD_LINK = "https://www.googleapis.com/upload/drive/v3/files/";
-+static const std::string GDRIVE_METADATA_LINK = "https://www.googleapis.com/drive/v3/files/";
- 
- class GdriveUtils
- {
-diff -ur libcmis.org/src/libcmis/oauth2-handler.cxx libcmis/src/libcmis/oauth2-handler.cxx
---- libcmis.org/src/libcmis/oauth2-handler.cxx	2021-07-27 19:11:02.676247009 +0200
-+++ libcmis/src/libcmis/oauth2-handler.cxx	2021-07-27 19:11:18.875246420 +0200
-@@ -92,8 +92,11 @@
-         "code="              + authCode +
-         "&client_id="        + m_data->getClientId() +
-         "&redirect_uri="     + m_data->getRedirectUri() +
--        "&scope="            + libcmis::escape( m_data->getScope() ) +
-         "&grant_type=authorization_code" ;
-+    if(boost::starts_with(m_data->getTokenUrl(), "https://oauth2.googleapis.com/"))
-+        post += "&client_secret="    + m_data->getClientSecret();
-+    else
-+        post += "&scope="            + libcmis::escape( m_data->getScope() );
- 
-     istringstream is( post );
- 
-@@ -104,7 +107,7 @@
-         resp = m_session->httpPostRequest ( m_data->getTokenUrl(), is,
-                                         "application/x-www-form-urlencoded" );
-     }
--    catch ( const CurlException& )
-+    catch ( const CurlException& e)
-     {
-         throw libcmis::Exception(
-                 "Couldn't get tokens from the authorization code ");
-@@ -122,6 +125,8 @@
-         "refresh_token="     + m_refresh +
-         "&client_id="        + m_data->getClientId() +
-         "&grant_type=refresh_token" ;
-+    if(boost::starts_with(m_data->getTokenUrl(), "https://oauth2.googleapis.com/"))
-+        post += "&client_secret="    + m_data->getClientSecret();
- 
-     istringstream is( post );
-     libcmis::HttpResponsePtr resp;
-@@ -130,7 +135,7 @@
-         resp = m_session->httpPostRequest( m_data->getTokenUrl( ), is,
-                                            "application/x-www-form-urlencoded" );
-     }
--    catch (const CurlException& )
-+    catch (const CurlException& e )
-     {
-         throw libcmis::Exception( "Couldn't refresh token ");
-     }
-diff -ur libcmis.org/src/libcmis/oauth2-providers.cxx libcmis/src/libcmis/oauth2-providers.cxx
---- libcmis.org/src/libcmis/oauth2-providers.cxx	2021-07-27 19:11:02.679247008 +0200
-+++ libcmis/src/libcmis/oauth2-providers.cxx	2021-07-27 19:11:18.886246420 +0200
-@@ -80,172 +80,8 @@
- 
- }
- 
--string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUrl,
--                                      const string& username, const string& password )
--{
--    /* This member function implements 'Google OAuth 2.0'
--     *
--     * The interaction is carried out by libcmis, with no web browser involved.
--     *
--     * Normal sequence (without 2FA) is:
--     * 1) a get to activate login page
--     *    receive first login page, html format
--     * 2) subsequent post to sent email
--     *    receive html page for password input
--     * 3) subsequent post to send password
--     *    receive html page for application consent
--     * 4) subsequent post to send a consent for the application
--     *    receive a single-use authorization code
--     *    this code is returned as a string
--     *
--     * Sequence with 2FA is:
--     * 1) a get to activate login page
--     *    receive first login page, html format
--     * 2) subsequent post to sent email
--     *    receive html page for password input
--     * 3) subsequent post to send password
--     *    receive html page for pin input
--     * 3b) subsequent post to send pin number
--     *    receive html page for application consent
--     * 4) subsequent post to send a consent for the application
--     *    receive a single-use authorization code
--     *    this code is returned as a string
--     */
--
--    static const string CONTENT_TYPE( "application/x-www-form-urlencoded" );
--    // STEP 1: get login page
--    string res;
--    try
--    {
--        // send the first get, receive the html login page
--        res = session->httpGetRequest( authUrl )->getStream( )->str( );
--    }
--    catch ( const CurlException& )
--    {
--        return string( );
--    }
--
--    // STEP 2: send email
--
--    string loginEmailPost, loginEmailLink;
--    if ( !parseResponse( res.c_str( ), loginEmailPost, loginEmailLink ) )
--        return string( );
--
--    loginEmailPost += "Email=";
--    loginEmailPost += escapeForm( username );
--
--    istringstream loginEmailIs( loginEmailPost );
--    string loginEmailRes;
--    try
--    {
--        // send a post with user email, receive the html page for password input
--        loginEmailRes = session->httpPostRequest ( loginEmailLink, loginEmailIs, CONTENT_TYPE )
--                        ->getStream( )->str( );
--    }
--    catch ( const CurlException& )
--    {
--        return string( );
--    }
--
--    // STEP 3: password page
--
--    string loginPasswdPost, loginPasswdLink;
--    if ( !parseResponse( loginEmailRes.c_str( ), loginPasswdPost, loginPasswdLink ) )
--        return string( );
--
--    loginPasswdPost += "Passwd=";
--    loginPasswdPost += escapeForm( password );
--
--    istringstream loginPasswdIs( loginPasswdPost );
--    string loginPasswdRes;
--    try
--    {
--        // send a post with user password, receive the application consent page
--        loginPasswdRes = session->httpPostRequest ( loginPasswdLink, loginPasswdIs, CONTENT_TYPE )
--                        ->getStream( )->str( );
--    }
--    catch ( const CurlException& )
--    {
--        return string( );
--    }
--
--    string approvalPost, approvalLink;
--    if ( !parseResponse( loginPasswdRes. c_str( ), approvalPost, approvalLink) )
--        return string( );
--
--    // when 2FA is enabled, link doesn't start with 'http'
--    if ( approvalLink.compare(0, 4, "http") != 0 )
--    {
--        // STEP 3b: 2 Factor Authentication, pin code request
--
--        string loginChallengePost( approvalPost );
--        string loginChallengeLink( approvalLink );
--
--        libcmis::OAuth2AuthCodeProvider fallbackProvider = libcmis::SessionFactory::getOAuth2AuthCodeProvider( );
--        unique_ptr< char, void (*)( void * ) > pin{ fallbackProvider( "", "", "" ), free };
--
--        if( !pin )
--        {
--            // unset OAuth2AuthCode Provider to avoid showing pin request again in the HttpSession::oauth2Authenticate
--            libcmis::SessionFactory::setOAuth2AuthCodeProvider( NULL );
--            return string( );
--        }
--
--        loginChallengeLink = "https://accounts.google.com" + loginChallengeLink;
--        loginChallengePost += string( PIN_INPUT_NAME ) + "=";
--        loginChallengePost += string( pin.get() );
--
--        istringstream loginChallengeIs( loginChallengePost );
--        string loginChallengeRes;
--        try
--        {
--            // send a post with pin, receive the application consent page
--            loginChallengeRes = session->httpPostRequest ( loginChallengeLink, loginChallengeIs, CONTENT_TYPE )
--                            ->getStream( )->str( );
--        }
--        catch ( const CurlException& )
--        {
--            return string( );
--        }
--
--        approvalPost = string();
--        approvalLink = string();
--
--        if ( !parseResponse( loginChallengeRes. c_str( ), approvalPost, approvalLink) )
--            return string( );
--    }
--    else if( approvalLink.compare( "https://accounts.google.com/ServiceLoginAuth" ) == 0 )
--    {
--        // wrong password,
--        // unset OAuth2AuthCode Provider to avoid showing pin request again in the HttpSession::oauth2Authenticate
--        libcmis::SessionFactory::setOAuth2AuthCodeProvider( NULL );
--        return string( );
--    }
--
--    // STEP 4: allow libcmis to access google drive
--    approvalPost += "submit_access=true";
--
--    istringstream approvalIs( approvalPost );
--    string approvalRes;
--    try
--    {
--        // send a post with application consent
--        approvalRes = session->httpPostRequest ( approvalLink, approvalIs,
--                            CONTENT_TYPE) ->getStream( )->str( );
--    }
--    catch ( const CurlException& e )
--    {
--        throw e.getCmisException( );
--    }
--
--    // Take the authentication code from the text bar
--    string code = parseCode( approvalRes.c_str( ) );
--
--    return code;
--}
--
--string OAuth2Providers::OAuth2Onedrive( HttpSession* /*session*/, const string& /*authUrl*/,
--                                      const string& /*username*/, const string& /*password*/ )
-+string OAuth2Providers::OAuth2Dummy( HttpSession* /*session*/, const string& /*authUrl*/,
-+                                     const string& /*username*/, const string& /*password*/ )
- {
-     return string( );
- }
-@@ -314,12 +150,8 @@
-         // For Alfresco in the cloud, only match the hostname as there can be several
-         // binding URLs created with it.
-         return OAuth2Alfresco;
--    else if ( boost::starts_with( url, "https://www.googleapis.com/drive/v2" ) )
--        return OAuth2Gdrive;
--    else if ( boost::starts_with( url, "https://graph.microsoft.com/v1.0" ) )
--        return OAuth2Onedrive;
- 
--    return OAuth2Gdrive;
-+    return OAuth2Dummy;
- }
- 
- int OAuth2Providers::parseResponse ( const char* response, string& post, string& link )
-diff -ur libcmis.org/src/libcmis/oauth2-providers.hxx libcmis/src/libcmis/oauth2-providers.hxx
---- libcmis.org/src/libcmis/oauth2-providers.hxx	2021-07-27 19:11:02.678247008 +0200
-+++ libcmis/src/libcmis/oauth2-providers.hxx	2021-07-27 19:11:18.886246420 +0200
-@@ -39,12 +39,8 @@
- class OAuth2Providers
- {
-     public :
--        static std::string OAuth2Gdrive( HttpSession* session, const std::string& authUrl, 
-+        static std::string OAuth2Dummy( HttpSession* session, const std::string& authUrl,
-                                        const std::string& username, const std::string& password );
--
--        static std::string OAuth2Onedrive( HttpSession* session, const std::string& authUrl, 
--                                       const std::string& username, const std::string& password );
--
-         static std::string OAuth2Alfresco( HttpSession* session, const std::string& authUrl, 
-                                        const std::string& username, const std::string& password );
- 
-diff -ur libcmis.org/src/libcmis/session-factory.cxx libcmis/src/libcmis/session-factory.cxx
---- libcmis.org/src/libcmis/session-factory.cxx	2021-07-27 19:11:02.679247008 +0200
-+++ libcmis/src/libcmis/session-factory.cxx	2021-07-27 19:11:18.886246420 +0200
-@@ -66,7 +66,7 @@
-         if ( !bindingUrl.empty( ) )
-         {
-             // Try the special cases based on the binding URL
--            if ( bindingUrl == "https://www.googleapis.com/drive/v2" )
-+            if ( bindingUrl == "https://www.googleapis.com/drive/v3" )
-             {
-                 session = new GDriveSession( bindingUrl, username, password,
-                                              oauth2, verbose );
diff --git a/external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1 b/external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1
deleted file mode 100644
index a8cb06509421..000000000000
--- a/external/libcmis/libcmis_oauth_pw_as_refreshtoken.patch.1
+++ /dev/null
@@ -1,185 +0,0 @@
-diff -ur libcmis.org/inc/libcmis/session.hxx libcmis/inc/libcmis/session.hxx
---- libcmis.org/inc/libcmis/session.hxx	2021-07-27 19:09:42.580249917 +0200
-+++ libcmis/inc/libcmis/session.hxx	2021-07-27 19:10:02.368249199 +0200
-@@ -95,6 +95,8 @@
-                 certificate exception feature available on common web browser.
-               */
-             virtual void setNoSSLCertificateCheck( bool noCheck ) = 0;
-+
-+            virtual std::string getRefreshToken() { return ""; };
-     };
- }
- 
-diff -ur libcmis.org/src/libcmis/gdrive-session.cxx libcmis/src/libcmis/gdrive-session.cxx
---- libcmis.org/src/libcmis/gdrive-session.cxx	2021-07-27 19:09:42.581249917 +0200
-+++ libcmis/src/libcmis/gdrive-session.cxx	2021-07-27 19:10:02.369249198 +0200
-@@ -70,6 +70,46 @@
- {
- }
- 
-+
-+void GDriveSession::setOAuth2Data( libcmis::OAuth2DataPtr oauth2 )
-+{
-+    m_oauth2Handler = new OAuth2Handler( this, oauth2 );
-+    m_oauth2Handler->setOAuth2Parser( OAuth2Providers::getOAuth2Parser( getBindingUrl( ) ) );
-+
-+    oauth2Authenticate( );
-+}
-+
-+void GDriveSession::oauth2Authenticate()
-+{
-+    // treat the supplied password as refresh token
-+    if (!m_password.empty())
-+    {
-+        try
-+        {
-+            m_inOAuth2Authentication = true;
-+
-+            m_oauth2Handler->setRefreshToken(m_password);
-+            // Try to get new access tokens using the stored refreshtoken
-+            m_oauth2Handler->refresh();
-+            m_inOAuth2Authentication = false;
-+        }
-+        catch (const CurlException &e)
-+        {
-+            m_inOAuth2Authentication = false;
-+            // refresh token expired or invalid, trigger initial auth (that in turn will hit the fallback with copy'n'paste method)
-+            BaseSession::oauth2Authenticate();
-+        }
-+    }
-+    else
-+    {
-+        BaseSession::oauth2Authenticate();
-+    }
-+}
-+
-+string GDriveSession::getRefreshToken() {
-+    return HttpSession::getRefreshToken();
-+}
-+
- libcmis::RepositoryPtr GDriveSession::getRepository( )
- {
-     // Return a dummy repository since GDrive doesn't have that notion
-diff -ur libcmis.org/src/libcmis/gdrive-session.hxx libcmis/src/libcmis/gdrive-session.hxx
---- libcmis.org/src/libcmis/gdrive-session.hxx	2021-07-27 19:09:42.583249917 +0200
-+++ libcmis/src/libcmis/gdrive-session.hxx	2021-07-27 19:10:02.369249198 +0200
-@@ -57,8 +57,14 @@
- 
-         virtual std::vector< libcmis::ObjectTypePtr > getBaseTypes( );
- 
-+        virtual std::string getRefreshToken();
-+
-     private:
-         GDriveSession( );
-+
-+        virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 );
-+
-+        void oauth2Authenticate( );
- };
- 
- #endif /* _GDRIVE_SESSION_HXX_ */
-diff -ur libcmis.org/src/libcmis/http-session.hxx libcmis/src/libcmis/http-session.hxx
---- libcmis.org/src/libcmis/http-session.hxx	2021-07-27 19:09:42.582249917 +0200
-+++ libcmis/src/libcmis/http-session.hxx	2021-07-27 19:10:02.369249198 +0200
-@@ -148,7 +148,7 @@
- 
-         void setNoSSLCertificateCheck( bool noCheck );
- 
--        std::string getRefreshToken( );
-+        virtual std::string getRefreshToken( );
- 
-     protected:
-         HttpSession( );
-diff -ur libcmis.org/src/libcmis/oauth2-handler.cxx libcmis/src/libcmis/oauth2-handler.cxx
---- libcmis.org/src/libcmis/oauth2-handler.cxx	2021-07-27 19:09:42.582249917 +0200
-+++ libcmis/src/libcmis/oauth2-handler.cxx	2021-07-27 19:10:02.369249198 +0200
-@@ -158,6 +158,11 @@
-     return m_refresh;
- }
- 
-+void OAuth2Handler::setRefreshToken( string refreshToken )
-+{
-+    m_refresh = refreshToken;
-+}
-+
- string OAuth2Handler::getHttpHeader( )
- {
-     string header;
-diff -ur libcmis.org/src/libcmis/oauth2-handler.hxx libcmis/src/libcmis/oauth2-handler.hxx
---- libcmis.org/src/libcmis/oauth2-handler.hxx	2021-07-27 19:09:42.582249917 +0200
-+++ libcmis/src/libcmis/oauth2-handler.hxx	2021-07-27 19:10:02.370249198 +0200
-@@ -61,6 +61,7 @@
- 
-         std::string getAccessToken( ) ;
-         std::string getRefreshToken( ) ;
-+        void setRefreshToken( std::string refreshToken ) ;
- 
-         // adding HTTP auth header
-         std::string getHttpHeader( ) ;
-diff -ur libcmis.org/src/libcmis/onedrive-session.cxx libcmis/src/libcmis/onedrive-session.cxx
---- libcmis.org/src/libcmis/onedrive-session.cxx	2021-07-27 19:09:42.583249917 +0200
-+++ libcmis/src/libcmis/onedrive-session.cxx	2021-07-27 19:10:02.370249198 +0200
-@@ -68,6 +68,45 @@
- {
- }
- 
-+void OneDriveSession::setOAuth2Data( libcmis::OAuth2DataPtr oauth2 )
-+{
-+    m_oauth2Handler = new OAuth2Handler( this, oauth2 );
-+    m_oauth2Handler->setOAuth2Parser( OAuth2Providers::getOAuth2Parser( getBindingUrl( ) ) );
-+
-+    oauth2Authenticate( );
-+}
-+
-+void OneDriveSession::oauth2Authenticate()
-+{
-+    // treat the supplied password as refresh token
-+    if (!m_password.empty())
-+    {
-+        try
-+        {
-+            m_inOAuth2Authentication = true;
-+
-+            m_oauth2Handler->setRefreshToken(m_password);
-+            // Try to get new access tokens using the stored refreshtoken
-+            m_oauth2Handler->refresh();
-+            m_inOAuth2Authentication = false;
-+        }
-+        catch (const CurlException &e)
-+        {
-+            m_inOAuth2Authentication = false;
-+            // refresh token expired or invalid, trigger initial auth (that in turn will hit the fallback with copy'n'paste method)
-+            BaseSession::oauth2Authenticate();
-+        }
-+    }
-+    else
-+    {
-+        BaseSession::oauth2Authenticate();
-+    }
-+}
-+
-+string OneDriveSession::getRefreshToken() {
-+    return HttpSession::getRefreshToken();
-+}
-+
- libcmis::RepositoryPtr OneDriveSession::getRepository( )
- {
-     // Return a dummy repository since OneDrive doesn't have that notion
-diff -ur libcmis.org/src/libcmis/onedrive-session.hxx libcmis/src/libcmis/onedrive-session.hxx
---- libcmis.org/src/libcmis/onedrive-session.hxx	2021-07-27 19:09:42.583249917 +0200
-+++ libcmis/src/libcmis/onedrive-session.hxx	2021-07-27 19:10:02.370249198 +0200
-@@ -62,8 +62,14 @@
- 
-        bool isAPathMatch( Json objectJson, std::string path );
- 
-+       virtual std::string getRefreshToken();
-+
-     private:
-         OneDriveSession( );
-+
-+        virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 );
-+
-+        void oauth2Authenticate( );
- };
- 
- #endif /* _ONEDRIVE_SESSION_HXX_ */
diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu
index fde7c90f9b26..816d22bc993c 100644
--- a/officecfg/registry/data/org/openoffice/Office/Common.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu
@@ -433,7 +433,7 @@
     </prop>
     <prop oor:name="CmisServersUrls">
       <value>
-        <it>https://www.googleapis.com/drive/v3</it>
+        <it>https://www.googleapis.com/drive/v2</it>
         <it>https://graph.microsoft.com/v1.0</it>
         <it>https://api.alfresco.com/cmis/versions/1.0/atom/</it>
         <it></it>
diff --git a/ucb/source/ucp/cmis/auth_provider.cxx b/ucb/source/ucp/cmis/auth_provider.cxx
index c4407f47cc3f..dd7b4f9f1e3c 100644
--- a/ucb/source/ucp/cmis/auth_provider.cxx
+++ b/ucb/source/ucp/cmis/auth_provider.cxx
@@ -11,10 +11,7 @@
 #define STD_TO_OUSTR( str ) OUString( str.c_str(), str.length( ), RTL_TEXTENCODING_UTF8 )
 
 #include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/task/PasswordContainer.hpp>
-#include <com/sun/star/task/XPasswordContainer2.hpp>
 
-#include <comphelper/processfactory.hxx>
 #include <ucbhelper/simpleauthenticationrequest.hxx>
 #include <ucbhelper/authenticationfallback.hxx>
 
@@ -67,91 +64,6 @@ namespace cmis
         return false;
     }
 
-    string AuthProvider::getRefreshToken(string& rUsername)
-    {
-        string refreshToken;
-        const css::uno::Reference<css::ucb::XCommandEnvironment> xEnv = getXEnv();
-        if (xEnv.is())
-        {
-            uno::Reference<task::XInteractionHandler> xIH = xEnv->getInteractionHandler();
-
-            if (rUsername.empty())
-            {
-                rtl::Reference<ucbhelper::SimpleAuthenticationRequest> xRequest
-                    = new ucbhelper::SimpleAuthenticationRequest(
-                        m_sUrl, m_sBindingUrl,
-                        ucbhelper::SimpleAuthenticationRequest::EntityType::ENTITY_NA, OUString(),
-                        ucbhelper::SimpleAuthenticationRequest::EntityType::ENTITY_MODIFY,
-                        STD_TO_OUSTR(rUsername),
-                        ucbhelper::SimpleAuthenticationRequest::EntityType::ENTITY_NA, OUString());
-                xIH->handle(xRequest.get());
-
-                rtl::Reference<ucbhelper::InteractionContinuation> xSelection
-                    = xRequest->getSelection();
-
-                if (xSelection.is())
-                {
-                    // Handler handled the request.
-                    uno::Reference<task::XInteractionAbort> xAbort(xSelection.get(),
-                                                                   uno::UNO_QUERY);
-                    if (!xAbort.is())
-                    {
-                        const rtl::Reference<ucbhelper::InteractionSupplyAuthentication>& xSupp
-                            = xRequest->getAuthenticationSupplier();
-
-                        rUsername = OUSTR_TO_STDSTR(xSupp->getUserName());
-                    }
-                }
-            }
-
-            uno::Reference<uno::XComponentContext> xContext
-                = ::comphelper::getProcessComponentContext();
-            uno::Reference<task::XPasswordContainer2> xMasterPasswd
-                = task::PasswordContainer::create(xContext);
-            if (xMasterPasswd->hasMasterPassword())
-            {
-                xMasterPasswd->authorizateWithMasterPassword(xIH);
-            }
-            if (xMasterPasswd->isPersistentStoringAllowed())
-            {
-                task::UrlRecord aRec
-                    = xMasterPasswd->findForName(m_sBindingUrl, STD_TO_OUSTR(rUsername), xIH);
-                if (aRec.UserList.hasElements() && aRec.UserList[0].Passwords.hasElements())
-                    refreshToken = OUSTR_TO_STDSTR(aRec.UserList[0].Passwords[0]);
-            }
-        }
-        return refreshToken;
-    }
-
-    bool AuthProvider::storeRefreshToken(const string& username, const string& password,
-                                         const string& refreshToken)
-    {
-        if (refreshToken.empty())
-            return false;
-        if (password == refreshToken)
-            return true;
-        const css::uno::Reference<css::ucb::XCommandEnvironment> xEnv = getXEnv();
-        if (xEnv.is())
-        {
-            uno::Reference<task::XInteractionHandler> xIH = xEnv->getInteractionHandler();
-            uno::Reference<uno::XComponentContext> xContext
-                = ::comphelper::getProcessComponentContext();
-            uno::Reference<task::XPasswordContainer2> xMasterPasswd
-                = task::PasswordContainer::create(xContext);
-            uno::Sequence<OUString> aPasswd{ STD_TO_OUSTR(refreshToken) };
-            if (xMasterPasswd->isPersistentStoringAllowed())
-            {
-                if (xMasterPasswd->hasMasterPassword())
-                {
-                    xMasterPasswd->authorizateWithMasterPassword(xIH);
-                }
-                xMasterPasswd->addPersistent(m_sBindingUrl, STD_TO_OUSTR(username), aPasswd, xIH);
-                return true;
-            }
-        }
-        return false;
-    }
-
     css::uno::WeakReference< css::ucb::XCommandEnvironment> AuthProvider::sm_xEnv;
 
     void AuthProvider::setXEnv(const css::uno::Reference< css::ucb::XCommandEnvironment>& xEnv )
@@ -164,7 +76,7 @@ namespace cmis
         return sm_xEnv;
     }
 
-    char* AuthProvider::copyWebAuthCodeFallback( const char* url,
+    char* AuthProvider::onedriveAuthCodeFallback( const char* url,
             const char* /*username*/,
             const char* /*password*/ )
     {
@@ -208,6 +120,46 @@ namespace cmis
 
         return strdup( "" );
     }
+
+    char* AuthProvider::gdriveAuthCodeFallback( const char* /*url*/,
+            const char* /*username*/,
+            const char* /*password*/ )
+    {
+        const css::uno::Reference<
+            css::ucb::XCommandEnvironment> xEnv = getXEnv( );
+
+        if ( xEnv.is() )
+        {
+            uno::Reference< task::XInteractionHandler > xIH
+                = xEnv->getInteractionHandler();
+
+            if ( xIH.is() )
+            {
+                rtl::Reference< ucbhelper::AuthenticationFallbackRequest > xRequest
+                    = new ucbhelper::AuthenticationFallbackRequest (
+                            "PIN:", "" );
+
+                xIH->handle( xRequest.get() );
+
+                rtl::Reference< ucbhelper::InteractionContinuation > xSelection
+                    = xRequest->getSelection();
+
+                if ( xSelection.is() )
+                {
+                    // Handler handled the request.
+                    const rtl::Reference< ucbhelper::InteractionAuthFallback >&
+                        xAuthFallback = xRequest->getAuthFallbackInter( );
+                    if ( xAuthFallback.is() )
+                    {
+                        OUString code = xAuthFallback->getCode( );
+                        return strdup( OUSTR_TO_STDSTR( code ).c_str( ) );
+                    }
+                }
+            }
+        }
+
+        return strdup( "" );
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/cmis/auth_provider.hxx b/ucb/source/ucp/cmis/auth_provider.hxx
index 462f7edba54d..24430401d278 100644
--- a/ucb/source/ucp/cmis/auth_provider.hxx
+++ b/ucb/source/ucp/cmis/auth_provider.hxx
@@ -39,11 +39,11 @@ namespace cmis
 
             bool authenticationQuery( std::string& username, std::string& password ) override;
 
-            std::string getRefreshToken( std::string& username );
-            bool storeRefreshToken(const std::string& username, const std::string& password,
-                                   const std::string& refreshToken);
+            static char* onedriveAuthCodeFallback( const char* url,
+                    const char* /*username*/,
+                    const char* /*password*/ );
 
-            static char* copyWebAuthCodeFallback( const char* url,
+            static char* gdriveAuthCodeFallback( const char* /*url*/,
                     const char* /*username*/,
                     const char* /*password*/ );
 
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index edb13ddf2457..355575d185d1 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -347,15 +347,12 @@ namespace cmis
             string rPassword = OUSTR_TO_STDSTR( m_aURL.getPassword( ) );
 
             bool bSkipInitialPWAuth = false;
-            if (m_aURL.getBindingUrl() == ONEDRIVE_BASE_URL
-                || m_aURL.getBindingUrl() == GDRIVE_BASE_URL)
-            {
+            if ( m_aURL.getBindingUrl( ) == ONEDRIVE_BASE_URL ) {
                 // skip the initial username and pw-auth prompt, the only supported method is the
                 // auth-code-fallback one (login with your browser, copy code into the dialog)
                 // TODO: if LO were to listen on localhost for the request, it would be much nicer
                 // user experience
                 bSkipInitialPWAuth = true;
-                rPassword = aAuthProvider.getRefreshToken(rUsername);
             }
 
             bool bIsDone = false;
@@ -368,9 +365,7 @@ namespace cmis
                     libcmis::OAuth2DataPtr oauth2Data;
                     if ( m_aURL.getBindingUrl( ) == GDRIVE_BASE_URL )
                     {
-                        // reset the skip, so user gets a chance to cancel
-                        bSkipInitialPWAuth = false;
-                        libcmis::SessionFactory::setOAuth2AuthCodeProvider(AuthProvider::copyWebAuthCodeFallback);
+                        libcmis::SessionFactory::setOAuth2AuthCodeProvider(AuthProvider::gdriveAuthCodeFallback);
                         oauth2Data.reset( new libcmis::OAuth2Data(
                             GDRIVE_AUTH_URL, GDRIVE_TOKEN_URL,
                             GDRIVE_SCOPE, GDRIVE_REDIRECT_URI,
@@ -385,7 +380,7 @@ namespace cmis
                     {
                         // reset the skip, so user gets a chance to cancel
                         bSkipInitialPWAuth = false;
-                        libcmis::SessionFactory::setOAuth2AuthCodeProvider(AuthProvider::copyWebAuthCodeFallback);
+                        libcmis::SessionFactory::setOAuth2AuthCodeProvider(AuthProvider::onedriveAuthCodeFallback);
                         oauth2Data.reset( new libcmis::OAuth2Data(
                             ONEDRIVE_AUTH_URL, ONEDRIVE_TOKEN_URL,
                             ONEDRIVE_SCOPE, ONEDRIVE_REDIRECT_URI,
@@ -417,12 +412,6 @@ namespace cmis
                         else
                         {
                             m_pProvider->registerSession(sSessionId, m_aURL.getUsername( ), m_pSession);
-                            if (m_aURL.getBindingUrl() == ONEDRIVE_BASE_URL
-                                || m_aURL.getBindingUrl() == GDRIVE_BASE_URL)
-                            {
-                                aAuthProvider.storeRefreshToken(rUsername, rPassword,
-                                                                m_pSession->getRefreshToken());
-                            }
                         }
 
                         bIsDone = true;
@@ -430,10 +419,7 @@ namespace cmis
                     catch( const libcmis::Exception & e )
                     {
                         if ( e.getType() != "permissionDenied" )
-                        {
-                            SAL_INFO("ucb.ucp.cmis", "Unexpected libcmis exception: " << e.what());
                             throw;
-                        }
                     }
                 }
                 else
@@ -525,7 +511,6 @@ namespace cmis
                 }
                 catch ( const libcmis::Exception& )
                 {
-                    SAL_INFO( "ucb.ucp.cmis", "object: " << OUSTR_TO_STDSTR(m_sObjectId));
                     throw libcmis::Exception( "Object not found" );
                 }
             }
diff --git a/ucb/source/ucp/cmis/cmis_repo_content.cxx b/ucb/source/ucp/cmis/cmis_repo_content.cxx
index 1bec3152b3b6..d98da53d5e2d 100644
--- a/ucb/source/ucp/cmis/cmis_repo_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_repo_content.cxx
@@ -165,7 +165,7 @@ namespace cmis
                     libcmis::OAuth2DataPtr oauth2Data;
                     if ( m_aURL.getBindingUrl( ) == GDRIVE_BASE_URL )
                     {
-                        libcmis::SessionFactory::setOAuth2AuthCodeProvider( AuthProvider::copyWebAuthCodeFallback );
+                        libcmis::SessionFactory::setOAuth2AuthCodeProvider( AuthProvider::gdriveAuthCodeFallback );
                         oauth2Data.reset( new libcmis::OAuth2Data(
                             GDRIVE_AUTH_URL, GDRIVE_TOKEN_URL,
                             GDRIVE_SCOPE, GDRIVE_REDIRECT_URI,
@@ -178,7 +178,7 @@ namespace cmis
                             ALFRESCO_CLOUD_CLIENT_ID, ALFRESCO_CLOUD_CLIENT_SECRET ) );
                     if ( m_aURL.getBindingUrl( ) == ONEDRIVE_BASE_URL )
                     {
-                        libcmis::SessionFactory::setOAuth2AuthCodeProvider( AuthProvider::copyWebAuthCodeFallback );
+                        libcmis::SessionFactory::setOAuth2AuthCodeProvider( AuthProvider::onedriveAuthCodeFallback );
                         oauth2Data.reset( new libcmis::OAuth2Data(
                             ONEDRIVE_AUTH_URL, ONEDRIVE_TOKEN_URL,
                             ONEDRIVE_SCOPE, ONEDRIVE_REDIRECT_URI,
-- 
2.31.1