Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuthAuthenticate逻辑问题isNewSession永远为false #47

Closed
boywangxj opened this issue Sep 25, 2016 · 3 comments
Closed

OAuthAuthenticate逻辑问题isNewSession永远为false #47

boywangxj opened this issue Sep 25, 2016 · 3 comments

Comments

@boywangxj
Copy link

isNewSession等于true时,直接return 走了,Event::fire(new WeChatUserAuthorized(session('wechat.oauth_user'), $isNewSession));这里的isNewSesssion 永远不可能为true

@overtrue
Copy link
Owner

overtrue commented Oct 1, 2016

@boywangxj 嗯,这块确实不正确,我需要修改一下。

@ddingchen
Copy link

其实单从这个事件定义的名称WeChatUserAuthorized来看,直接在用户通过授权后的处理代码中触发这个事件就可以了,也不需要$isNewSession这个变量,代码也更清晰简单,不知道我这样理解对不对,或者有我没有考虑到的使用情景。
if ($request->has('state') && $request->has('code')) {
session(['wechat.oauth_user' => $this->wechat->oauth->user()]);
Event::fire(new WeChatUserAuthorized(session('wechat.oauth_user')));
return redirect()->to($this->getTargetUrl($request));
}

@overtrue
Copy link
Owner

isNewSession 表示是第一次授权, session 没过期之前的后续所有授权都不是第一次

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants