Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Handle/GoogleOauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ public function getUserInfo($access_token)
'access_token' => $access_token,
]);

return json_decode($this->client->request('GET', $url, [
return json_decode($this->client->request('GET', $url, [
'query' => $query,
])->getBody()->getContents());

}
}
4 changes: 4 additions & 0 deletions src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@ public static function getAccessToken($deiver, $oauth, $key = 'access_token')
$access_token = $params[1];
$access_token = explode('&', $access_token);
$access_token = $access_token[0];

return $access_token;
break;
case 'gitlab':
$oauth = json_decode($oauth, true);

return 'Bearer '.$oauth[$key];
break;
case 'gitee':
$oauth = json_decode($oauth, true);

return $oauth[$key];
break;
case 'google':
$oauth = json_decode($oauth, true);

return $oauth[$key];
break;
default:
Expand Down
14 changes: 8 additions & 6 deletions src/SocialiteAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,42 @@ class SocialiteAuth implements Socialite
{
/**
* user info object.
*
* @var
*/
protected $userObject;


/**
* 目前支持的授权平台.
*
* @var string[]
*/
private static $deiver = ['gitee', 'github', 'weibo', 'gitlab',
'qq', 'weixin', 'microsoft', 'alipay', 'xiaomi', 'google',
'huawei', 'douyin', 'line', 'qqapp', 'alipayapp', 'jd'];
'huawei', 'douyin', 'line', 'qqapp', 'alipayapp', 'jd', ];

/**
* 初始化的配置数组.
*
* @var array
*/
protected $config = [
'client_id' => '',
'client_id' => '',
'redirect_uri' => '',
'client_secret'=> ''
'client_secret' => '',
];

public function __construct($config = [])
{
if (is_array($config)) $this->config = $config;
if (is_array($config)) {
$this->config = $config;
}
}

public function driver($deiver): SocialiteAuth
{
//兼容laravel app容器参数注入
if (array_key_exists($deiver, $this->config)) {

$this->config = $this->config[$deiver];
}
$this->verified($deiver);
Expand Down