久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Laravel 5 Auth Post Submit - VerifyCsrfToken.php 第 46 行中的

Laravel 5 Auth Post Submit - TokenMismatchException in VerifyCsrfToken.php line 46(Laravel 5 Auth Post Submit - VerifyCsrfToken.php 第 46 行中的 TokenMismatchException)
本文介紹了Laravel 5 Auth Post Submit - VerifyCsrfToken.php 第 46 行中的 TokenMismatchException的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

剛剛在 Laravel 5 中開發了一個新應用程序,我在使用開箱即用的身份驗證時遇到了一些問題...

Have just statred a new app in Laravel 5 and I am having some trouble using the out of the box auth...

我不斷收到:VerifyCsrfToken.php 第 46 行中的 TokenMismatchException:在提交登錄或注冊表單時...

I keep getting : TokenMismatchException in VerifyCsrfToken.php line 46: on submitting the login or signup forms...

我可以在登錄表單頁面上看到隱藏表單字段中的令牌代碼和當時的會話是相同的...

I can see on the login form page the token codes that are in the hidden form field and Session at that point are the same...

作為測試,我也嘗試過,因為其他一些帖子建議將其注釋掉//'AppHttpMiddlewareVerifyCsrfToken',在 app/Http/kernal.php 中查看會發生什么.每次提交表單后,我都會收到一條消息,提示重定向到:/auth/login 或/auth/register,具體取決于我來自哪里,但沒有成功.

As a test I have also tried as some other posts suggested commenting out //'AppHttpMiddlewareVerifyCsrfToken', in app/Http/kernal.php to see what would happen. After doing this every time I submit a form I get a message which says redirecting to: /auth/login or /auth/register depending on where I came from with no success.

奇怪的是,當我第一次安裝這個框架時,它就起作用了.從那時起,我所做的就是運行一些遷移并設置我的一些模型和控制器,并將一些用戶數據植入數據庫.

The weird thing was this was working when I first installed the framework. All I have done since then is run a few migrations and setup some of my models and controllers and seeded the db with some user data.

更新:

如果我:

var_dump($request->session()->token());

var_dump($request->input('_token'));

我可以看到兩個標記不同,但在使用的表單中:

I can see the two tokens are different but at the form using:

var_dump(Session::all());

{{{ csrf_token() }}}

它們是一樣的.Session 令牌在到達 VerifyCsrfToken.php 的第 55 行的函數 tokensMatch() 之前發生了一些變化

They are the same. The Session token has changed some how before it gets to the function tokensMatch() on line 55 of VerifyCsrfToken.php

我的堆棧跟蹤如下:

in VerifyCsrfToken.php line 46
at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->IlluminatePipeline{closure}(object(Request)) in ShareErrorsFromSession.php line 55
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->IlluminatePipeline{closure}(object(Request)) in StartSession.php line 61
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->IlluminatePipeline{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->IlluminatePipeline{closure}(object(Request)) in EncryptCookies.php line 40
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->IlluminatePipeline{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->IlluminatePipeline{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Kernel.php line 111
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 84
at Kernel->handle(object(Request)) in index.php line 53

推薦答案

我剛開始工作時刪除了該行:

I first just got it working removing the line:

'IlluminateFoundationHttpMiddlewareVerifyCsrfToken'

'IlluminateFoundationHttpMiddlewareVerifyCsrfToken'

來自/app/Http/Resquests/Kernel.php.但是,這意味著 CSRF 令牌檢查 將被刪除,這意味著您的網站將不受保護跨站點請求偽造.

from /app/Http/Resquests/Kernel.php. However, this means the CSRF token check will be removed, which implies that your website will not be protected from cross-site request forgeries.

更新根據文檔,您應該通過將此代碼段添加到您的代碼中來將CSRF令牌添加到您的表單中:

Update According to the documentation, you should add the CSRF token to your form by adding this snippet to your code:

<input type="hidden" name="_token" value="{{ csrf_token() }}">

我在移動應用程序的后端服務中使用了第一種方式,但我發現我可以在請求中發送 CSRF 標頭.

I used first way in backend services for mobile application but I find I can send send CSRF header within requests.

這篇關于Laravel 5 Auth Post Submit - VerifyCsrfToken.php 第 46 行中的 TokenMismatchException的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Laravel Eloquent Union query(Laravel Eloquent Union 查詢)
Overwrite laravel 5 helper function(覆蓋 Laravel 5 輔助函數)
laravel querybuilder how to use like in wherein function(laravel querybuilder 如何在 where 函數中使用 like)
The Response content must be a string or object implementing __toString(), quot;booleanquot; given after move to psql(響應內容必須是實現 __toString()、“boolean和“boolean的字符串或對象.移動到 psql 后給出) - IT屋-程
Roles with laravel 5, how to allow only admin access to some root(Laravel 5 的角色,如何只允許管理員訪問某些根)
Laravel Auth - use md5 instead of the integrated Hash::make()(Laravel Auth - 使用 md5 而不是集成的 Hash::make())
主站蜘蛛池模板: 精品乱码久久久久 | 久久午夜国产精品www忘忧草 | 久久国产高清视频 | 国产免费高清 | 精品国产一区二区在线 | 久久综合一区二区三区 | h视频在线免费 | 久久99精品久久 | 日韩视频在线免费观看 | 密室大逃脱第六季大神版在线观看 | 欧美日韩不卡合集视频 | 午夜视频在线免费观看 | 91精品亚洲 | 国产欧美日韩综合精品一区二区 | 亚洲大片一区 | 亚洲一区在线日韩在线深爱 | 国产精品射| 成人影院免费视频 | 黄色片a级 | 久久精品亚洲精品国产欧美 | 日本五月婷婷 | 91久久 | 亚洲精品久久久一区二区三区 | 欧美精品一区二区三区蜜桃视频 | 国产特级毛片 | 黄色毛片免费视频 | 在线观看第一页 | 久久久久亚洲 | 成人深夜福利网站 | 欧美一区二区三区久久精品 | av天天看 | 欧美性生活一区二区三区 | 欧美日韩亚洲视频 | 殴美成人在线视频 | 久久久久久综合 | 欧美亚洲免费 | 精品小视频 | 国产精品久久久久9999鸭 | 亚洲国产成人在线观看 | 日韩精品久久久久 | 亚洲一区二区三区在线视频 |