fix: shareurl no apiurl

pull/578/head
qkqpttgf 2020-04-07 20:54:10 +08:00 committed by GitHub
parent 09270d47cd
commit 0b6cb4ba66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -345,7 +345,9 @@ function get_access_token($refresh_token)
} }
error_log('Get access token:'.json_encode($ret, JSON_PRETTY_PRINT)); error_log('Get access token:'.json_encode($ret, JSON_PRETTY_PRINT));
savecache('access_token', $_SERVER['access_token']); savecache('access_token', $_SERVER['access_token']);
if (getConfig('sharecookie')==''||getConfig('shareapiurl')=='') setConfig([ 'sharecookie' => $_SERVER['sharecookie'], 'shareapiurl' => $_SERVER['api_url'] ]); $tmp = [];
$tmp['shareapiurl'] = $_SERVER['api_url'];
if (getConfig('shareapiurl')=='') setConfig($tmp);
} else { } else {
$response = curl_request( $_SERVER['oauth_url'] . 'token', 'client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token ); $response = curl_request( $_SERVER['oauth_url'] . 'token', 'client_id='. $_SERVER['client_id'] .'&client_secret='. $_SERVER['client_secret'] .'&grant_type=refresh_token&requested_token_use=on_behalf_of&refresh_token=' . $refresh_token );
if ($response['stat']==200) $ret = json_decode($response['body'], true); if ($response['stat']==200) $ret = json_decode($response['body'], true);