0π
I had the same issue, decided to stick to client_secret way. I guess itβs not relevant for you now, but Iβve found 2 ways of receiving the laravel token without refresh:
1) sending dummy get request with axios or $http, whatever you use β token will get attached to response;
2) changing requestShouldReceiveFreshToken method in CreateFreshApiToken.php β replace return $request->isMethod('GET') && $request->user($this->guard);
with return ($request->isMethod('GET') || $request->isMethod('POST')) && $request->user($this->guard);
π€Be Kind
- [Vuejs]-Vue directives inside templates
- [Vuejs]-User authentication with Vue.js 2 and Express.js with Passport
0π
function consumeOwnApi($uri, $method = 'GET', $parameters = array())
{
$req = \Illuminate\Http\Request::create($uri, $method, $parameters, $_COOKIE);
$req->headers->set('X-CSRF-TOKEN', app('request')->session()->token());
return app()->handle($req)->getData();
}
π€huangfu
Source:stackexchange.com