我正在使用Laravel 5.1我試圖實現一個基本的JWT-Auth
邏輯。JWT Cookie不存儲正確 - Laravel
,而我創造jwt_token
權(我把它記錄到laravel.log
,令牌有它的預期點分成三個不同的部分),當我嘗試創建一個jwt_token
值一個cookie,將創建一個完全不同的Cookie ,沒有按點劃分,並且比原來的jwt_token
大得多。
我覺得代碼是非常簡單的:
$jwt_token = $this->findOrCreateUser($user);
Log::error('My jwt_token is '. $jwt_token); //from the log here i see the right jwt_token
//i disable the http-only flag because i want to read it with js
return redirect('/index.html')->withCookie(Cookie::make('jwt_token',$jwt_token,1000,null,null,false,false));
我會很高興,如果有人可以給我什麼可能是錯誤的一些指點!
感謝
謝謝!很好的答案。 我應該仔細閱讀這裏的文檔https://laravel.com/docs/5.0/requests#cookies,你是對的! –
非常歡迎。 – Bogdan