fix bug: access token be 1

pull/188/head
root 2021-01-16 11:28:19 +08:00
parent 15a7ea192a
commit b44f15f141
6 changed files with 6 additions and 6 deletions

View File

@ -709,6 +709,7 @@ class Aliyundrive {
$this->access_token = $ret['access_token'];
savecache('access_token', $this->access_token, $this->disktag, $ret['expires_in'] - 300);
if (time()>getConfig('token_expires', $this->disktag)) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+7*24*60*60 ], $this->disktag);
return true;
}
return true;
}

View File

@ -731,6 +731,7 @@ class Onedrive {
$this->access_token = $ret['access_token'];
savecache('access_token', $this->access_token, $this->disktag, $ret['expires_in'] - 300);
if (time()>getConfig('token_expires', $this->disktag)) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+7*24*60*60 ], $this->disktag);
return true;
}
return true;
}

View File

@ -16,8 +16,7 @@ class OnedriveCN extends Onedrive {
$this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
$this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
$this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All offline_access';
$this->access_token = getcache('access_token', $tag);
if (!$this->access_token) $this->access_token = $this->get_access_token(getConfig('refresh_token', $tag));
$res = $this->get_access_token(getConfig('refresh_token', $tag));
$this->client_secret = urlencode($this->client_secret);
$this->scope = urlencode($this->scope);

View File

@ -52,6 +52,7 @@ class Sharelink extends Onedrive {
if (getConfig('shareapiurl', $this->disktag)!=$this->api_url) $tmp1['shareapiurl'] = $this->api_url;
//if (getConfig('sharecookie', $this->disktag)!=$this->sharecookie) $tmp1['sharecookie'] = $this->sharecookie;
if (!!$tmp1) setConfig($tmp1);
return true;
}
return true;
}

View File

@ -16,8 +16,7 @@ class Sharepoint extends Onedrive {
$this->oauth_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/';
$this->api_url = 'https://graph.microsoft.com/v1.0';
$this->scope = 'https://graph.microsoft.com/Files.ReadWrite.All offline_access';
$this->access_token = getcache('access_token', $tag);
if (!$this->access_token) $this->access_token = $this->get_access_token(getConfig('refresh_token', $tag));
$res = $this->get_access_token(getConfig('refresh_token', $tag));
$this->client_secret = urlencode($this->client_secret);
$this->scope = urlencode($this->scope);

View File

@ -16,8 +16,7 @@ class SharepointCN extends Onedrive {
$this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
$this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
$this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All offline_access';
$this->access_token = getcache('access_token', $tag);
if (!$this->access_token) $this->access_token = $this->get_access_token(getConfig('refresh_token', $tag));
$res = $this->get_access_token(getConfig('refresh_token', $tag));
$this->client_secret = urlencode($this->client_secret);
$this->scope = urlencode($this->scope);