We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
返回回来的 code 一直失效或者二次使用, 导致无法获取用户信息.
log
[2020-10-09 10:14:19] production.ERROR: 获取用户信息失败 {"msg":"Authorize Failed: {\"errcode\":40163,\"errmsg\":\"code been used, hints: [ req_id: GEeEWaMre-GRQona ]\"}"} [2020-10-09 10:14:20] production.ERROR: 获取用户信息失败 {"msg":"Authorize Failed: {\"errcode\":40029,\"errmsg\":\"invalid code, hints: [ req_id: GEeEUqNre-TL.5ya ]\"}"}
middleware.php
public function handle(Request $request, Closure $next) { $session = session(self::SESSION_KEY, []); // Log::error('user', ['data' => $session]); if (!$session) { /** @var Application $officialAccount */ $officialAccount = app('wechat.official_account.wwf'); if ($request->has('code')) { try { $user = $officialAccount->oauth->user(); // 存储到session session([self::SESSION_KEY => $user]); // 重定向到首页 // return redirect()->to($this->getTargetUrl($request)); return redirect()->route('module.wwf.home'); } catch (AuthorizeFailedException $e) { Log::error('获取用户信息失败', ['msg' => $e->getMessage()]); return redirect()->route('module.wwf.home'); } } session()->forget(self::SESSION_KEY); return $officialAccount->oauth->scopes(['snsapi_userinfo']) ->redirect($request->fullUrl()); } return $next($request); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
返回回来的 code 一直失效或者二次使用, 导致无法获取用户信息.
log
middleware.php
The text was updated successfully, but these errors were encountered: