Laravel Http请求路由永远发送



我想在发送给用户的电子邮件中有一个链接,该链接是网站的url,并有一个api令牌供用户验证。

然而,我试图发送一个api请求来获取用户的详细信息,这样我就可以对用户进行身份验证并将他们重定向到relavent页面,然而,这样我最终会收到一个无休止旋转的请求。

可能是什么问题,如果有其他解决方案,请告诉我。

链接/请求看起来像这个

http://localhost:8005/api/token?_token=<API TOKEN>

处理请求的控制器

<?php
namespace AppHttpControllers;
use Auth;
use IlluminateHttpRequest;
use IlluminateSupportFacadesURL;
use IlluminateSupportFacadesHttp;
class PassportController extends Controller
{
function getToken(Request $request)
{
// return $request->_token;
return $user = Http::withToken($request->_token)->get('http://localhost:8005/api/user');
Auth::login($user);
return redirect('/dashboard');
}
}

此外,当我发送请求时,它会被卡住,我必须再次重新启动我的php手工服务来发出更多请求,每次我这样做时,它都会打开一个新的端口,800180028003等

您可以像这样回调应用程序本身:

$tokenRequest = Request::create('/api/user', 'GET', ['name' => 'value']);
$tokenResult = app()->handle($tokenRequest);

更新变量以匹配您的实现。

最新更新