thinkphp框架种使用overtrue/socialite

使用过程中会出现session冲突的问题:

自定义使用thinkphp的session验证

 $this->socialite = new SocialiteManager($config);
$state = sha1(uniqid(mt_rand(1, 1000000), true));
Session('state',$state);
return  $this->socialite->driver('qq')->stateless()->with(['state'=>$state])->redirect();

callback验证:

$user = $this->socialite->driver('qq')->stateless()->user();
$_state = $this->request->param('state');
$state = Session('state');
if(md5($state)!=md5($_state)){
     $this->error('非法来源');
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注