laravel API unatuhorize с использованием режима инкогнито - PullRequest
0 голосов
/ 20 марта 2020

laravel токен доступа с ошибкой неавторизован при использовании Chrome в режиме инкогнито, но при использовании без инкогнито это нормально, не проблема .. ................... .................................................. .................................................. ....................... маршрут паспорта:

Route::middleware('auth:api')->get('details', 'api\AuthController@details');

 $user = Auth::user(); 
        return response()->json(['success' => $user]); 

Ошибка в режиме инкогнито

    xhr.js:178 GET http://127.0.0.1:8000/api/details 401 (Unauthorized)
dispatchXhrRequest @ xhr.js:178
xhrAdapter @ xhr.js:12
dispatchRequest @ dispatchRequest.js:52
Promise.then (async)
request @ Axios.js:61
Axios.<computed> @ Axios.js:76
wrap @ bind.js:9
GetGroup @ group.js:23
componentDidMount @ group.js:17
commitLifeCycles @ react-dom.development.js:19847
commitLayoutEffects @ react-dom.development.js:22834
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
commitRootImpl @ react-dom.development.js:22572
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11061
commitRoot @ react-dom.development.js:22412
finishSyncRender @ react-dom.development.js:21838
performSyncWorkOnRoot @ react-dom.development.js:21824
scheduleUpdateOnFiber @ react-dom.development.js:21219
updateContainer @ react-dom.development.js:24407
(anonymous) @ react-dom.development.js:24792
unbatchedUpdates @ react-dom.development.js:21934
legacyRenderSubtreeIntoContainer @ react-dom.development.js:24791
render @ react-dom.development.js:24874
./src/index.js @ index.js:15
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
1 @ serviceWorker.js:141
__webpack_require__ @ bootstrap:785
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
createError.js:16 Uncaught (in promise) Error: Request failed with status code 401
    at createError (createError.js:16)
    at settle (settle.js:17)
    at XMLHttpRequest.handleLoad (xhr.js:61)

без инкогнито

{url: "/api/details", method: "get", headers: {…}, baseURL: "http://127.0.0.1:8000", transformRequest: Array(1), …}
url: "/api/details"
method: "get"
headers: {Accept: "application/json, text/plain, */*", Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdW…jJZtojRnkthBaCubZa4o5JKi-qzMn_RW9U6Z1fTKZHrV9-g7w"}
baseURL: "http://127.0.0.1:8000"
transformRequest: [ƒ]
transformResponse: [ƒ]
timeout: 0
adapter: ƒ xhrAdapter(config)
xsrfCookieName: "XSRF-TOKEN"
xsrfHeaderName: "X-XSRF-TOKEN"
maxContentLength: -1
validateStatus: ƒ validateStatus(status)
data: undefined
__proto__: Objec
...