解决新装后插入用户无法登陆的问题

This commit is contained in:
2020-04-20 13:13:09 +08:00
parent 1a68cddd1c
commit ed57619b65
5 changed files with 24 additions and 27 deletions

View File

@@ -70,7 +70,8 @@ class Weibo {
"access_token" => $access_token,
"uid" => $uid,
];
$ret = Http::get(self::GET_USERINFO_URL, $queryarr);
$client = new \GuzzleHttp\Client();
$ret = $client->post(self::GET_USERINFO_URL, ['form_params' => $queryarr])->getBody()->getContents();
$userinfo = (array) json_decode($ret, true);
if (!$userinfo || isset($userinfo['error_code'])) {
return [];
@@ -107,7 +108,8 @@ class Weibo {
"redirect_uri" => $this->config['callback'],
"code" => $code,
);
$response = Http::post(self::GET_ACCESS_TOKEN_URL, $queryarr);
$client = new \GuzzleHttp\Client();
$response = $client->post(self::GET_ACCESS_TOKEN_URL, ['form_params' => $queryarr])->getBody()->getContents();
$ret = (array) json_decode($response, true);
return $ret ? $ret : [];
}