MDL-59510 core_oauth2: autorefresh google drive, nextcloud and onedrive
authorJake Dallimore <jake@moodle.com>
Fri, 18 Sep 2020 09:24:40 +0000 (17:24 +0800)
committerJake Dallimore <jake@moodle.com>
Mon, 5 Oct 2020 01:17:14 +0000 (09:17 +0800)
Request additional offline access, allowing the repository to sign in
automatically each time, including across different user sessions, until
either the refresh token is invalidated or the user logs out of the
repository.

repository/googledocs/lib.php
repository/nextcloud/lib.php
repository/onedrive/lib.php

index 88e5c9a..0f62e8e 100644 (file)
@@ -97,7 +97,7 @@ class repository_googledocs extends repository {
             $returnurl->param('sesskey', sesskey());
         }
 
-        $this->client = \core\oauth2\api::get_user_oauth_client($this->issuer, $returnurl, self::SCOPES);
+        $this->client = \core\oauth2\api::get_user_oauth_client($this->issuer, $returnurl, self::SCOPES, true);
 
         return $this->client;
     }
index e2ad61f..62f38c0 100644 (file)
@@ -574,7 +574,7 @@ class repository_nextcloud extends repository {
             $returnurl->param('repo_id', $this->id);
             $returnurl->param('sesskey', sesskey());
         }
-        $this->client = \core\oauth2\api::get_user_oauth_client($this->issuer, $returnurl, self::SCOPES);
+        $this->client = \core\oauth2\api::get_user_oauth_client($this->issuer, $returnurl, self::SCOPES, true);
         return $this->client;
     }
 
index f03c8dc..b2c6d80 100644 (file)
@@ -93,7 +93,7 @@ class repository_onedrive extends repository {
             $returnurl->param('sesskey', sesskey());
         }
 
-        $this->client = \core\oauth2\api::get_user_oauth_client($this->issuer, $returnurl, self::SCOPES);
+        $this->client = \core\oauth2\api::get_user_oauth_client($this->issuer, $returnurl, self::SCOPES, true);
 
         return $this->client;
     }