调试微信授权登录
This commit is contained in:
parent
891ab45bdf
commit
54bf58b197
@ -874,9 +874,10 @@ class Auth extends BaseController
|
|||||||
throw new ValidateException('授权失败[003]');
|
throw new ValidateException('授权失败[003]');
|
||||||
return $user;
|
return $user;
|
||||||
} else if ($auth['type'] === 'app_wechat') {
|
} else if ($auth['type'] === 'app_wechat') {
|
||||||
$oauth = WechatService::create()->getApplication()->oauth;
|
$oauth = WechatService::create(true)->getApplication()->oauth;
|
||||||
|
$accessToken = $oauth->getAccessToken($data['code']);
|
||||||
try {
|
try {
|
||||||
$wechatInfo = $oauth->user(new AccessToken(['access_token' => $data['code'], 'openid' => $data['openid']]))->getOriginal();
|
$wechatInfo = $oauth->user($accessToken)->getOriginal();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new ValidateException('授权失败[001]' . $e->getMessage());
|
throw new ValidateException('授权失败[001]' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user