diff --git a/app/Http/Home/Views/user/console/account_info.volt b/app/Http/Home/Views/user/console/account_info.volt
index c34cf069..d275299b 100644
--- a/app/Http/Home/Views/user/console/account_info.volt
+++ b/app/Http/Home/Views/user/console/account_info.volt
@@ -63,28 +63,30 @@
diff --git a/app/Library/OAuth/QQ.php b/app/Library/OAuth/QQ.php
index ba0ee84c..69d488df 100644
--- a/app/Library/OAuth/QQ.php
+++ b/app/Library/OAuth/QQ.php
@@ -33,7 +33,6 @@ class QQ extends OAuth
'client_secret' => $this->clientSecret,
'redirect_uri' => $this->redirectUri,
'grant_type' => 'authorization_code',
- 'state' => 'ok',
];
$response = $this->httpPost(self::ACCESS_TOKEN_URL, $params);
@@ -90,7 +89,7 @@ class QQ extends OAuth
}
if (!isset($result['openid'])) {
- throw new \Exception("Fetch Openid Failed:{$response}");
+ throw new \Exception("Fetch OpenId Failed:{$response}");
}
return $result['openid'];
@@ -100,8 +99,8 @@ class QQ extends OAuth
{
$data = json_decode($response, true);
- if ($data['ret'] != 0) {
- throw new \Exception("Fetch User Info Failed:{$data['msg']}");
+ if (isset($data['ret']) && $data['ret'] != 0) {
+ throw new \Exception("Fetch User Info Failed:{$response}");
}
$userInfo['id'] = $this->openId;
diff --git a/app/Library/OAuth/WeiBo.php b/app/Library/OAuth/WeiBo.php
index 9ccb0268..88f69948 100644
--- a/app/Library/OAuth/WeiBo.php
+++ b/app/Library/OAuth/WeiBo.php
@@ -8,7 +8,7 @@ class WeiBo extends OAuth
{
const AUTHORIZE_URL = 'https://api.weibo.com/oauth2/authorize';
- const ACCESS_TOKEN_URL = 'https://api.weibo.com/oauth2/oauth2/access_token';
+ const ACCESS_TOKEN_URL = 'https://api.weibo.com/oauth2/access_token';
const USER_INFO_URL = 'https://api.weibo.com/2/users/show.json';
public function getAuthorizeUrl()
@@ -60,8 +60,8 @@ class WeiBo extends OAuth
private function parseAccessToken($response)
{
$data = json_decode($response, true);
-
- if (!isset($data['access_token']) || isset($data['uid'])) {
+
+ if (!isset($data['access_token']) || !isset($data['uid'])) {
throw new \Exception("Fetch Access Token Failed:{$response}");
}
@@ -74,8 +74,8 @@ class WeiBo extends OAuth
{
$data = json_decode($response, true);
- if ($data['error_code'] != 0) {
- throw new \Exception("Fetch User Info Failed:{$data['error']}");
+ if (isset($data['error_code']) && $data['error_code'] != 0) {
+ throw new \Exception("Fetch User Info Failed:{$response}");
}
$userInfo['id'] = $this->openId;
diff --git a/app/Library/OAuth/WeiXin.php b/app/Library/OAuth/WeiXin.php
index 7be80e62..114a42ba 100644
--- a/app/Library/OAuth/WeiXin.php
+++ b/app/Library/OAuth/WeiXin.php
@@ -62,7 +62,7 @@ class WeiXin extends OAuth
$data = json_decode($response, true);
if (isset($data['errcode']) && $data['errcode'] != 0) {
- throw new \Exception("Fetch Access Token Failed:{$data['errmsg']}");
+ throw new \Exception("Fetch Access Token Failed:{$response}");
}
$this->openId = $data['openid'];
@@ -75,7 +75,7 @@ class WeiXin extends OAuth
$data = json_decode($response, true);
if (isset($data['errcode']) && $data['errcode'] != 0) {
- throw new \Exception("Fetch User Info Failed:{$data['errmsg']}");
+ throw new \Exception("Fetch User Info Failed:{$response}");
}
$userInfo['id'] = $this->openId;