Blame SOURCES/0001-Revert-tdf-101630-gdrive-support-w-oAuth-and-Drive-A.patch

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