You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open AdGuard AdBlocker option and enable "Filters -> Annoyances -> AdGuard Annoyances filter" like following:
Start server with mix phx.server
Visit http://localhost:4000 and register a user (You can see the "Register" link in the header as it has been added by phx_gen_auth), you will be auto logged in
Click "Log out" link in the header and you can see message like [debug] LiveView session was misconfigured... in the console as following
[info] POST /users/log_out[debug] Processing withPlayWeb.UserSessionController.delete/2Parameters: %{"_csrf_token"=>"LDF6dgFfLzkFMzgoYAtOF18HIUY7Mn4FZdJDXiluUFAP-q8thowuMJ96","_method"=>"delete"}Pipelines: [:browser][debug] QUERY OK source="users_tokens" db=0.5ms idle=1083.9msSELECT u1."id",u1."email",u1."hashed_password",u1."confirmed_at",u1."inserted_at",u1."updated_at"FROM "users_tokens" AS u0 INNER JOIN "users" AS u1 ON u1."id" =u0."user_id"WHERE((u0."token"= $1) AND (u0."context"= $2)) AND (u0."inserted_at"> $3::timestamp+(-60::decimal::numeric*interval'1 day'))[<<241,26,49,228,154,155,136,99,93,41,35,169,250,211,66,149,246,98,169,229,22,156,180,100,95,39,232,142,31,6,181,85>>,"session",~U[2020-12-31 09:36:26.233904Z]][debug] QUERY OK source="users_tokens" db=1.0ms queue=1.0ms idle=1079.1msDELETE FROM "users_tokens" AS u0 WHERE ((u0."token" = $1) AND (u0."context" = $2)) [<<241, 26, 49, 228, 154, 155, 136, 99, 93, 41, 35, 169, 250, 211, 66, 149, 246, 98, 169, 229, 22, 156, 180, 100, 95, 39, 232, 142, 31, 6, 181, 85>>, "session"][info] Sent 302 in 5ms[info] CONNECTED TO Phoenix.LiveView.Socket in 115µs Transport: :websocket Serializer: Phoenix.Socket.V2.JSONSerializer Parameters: %{"_csrf_token" => "LDF6dgFfLzkFMzgoYAtOF18HIUY7Mn4FZdJDXiluUFAP-q8thowuMJ96", "_mounts" => "0", "_track_static" => %{"0" => "http://localhost:4000/css/app.css", "1" =>"http://localhost:4000/js/app.js"},"vsn"=>"2.0.0"}[debug] LiveView session was misconfigured ortheusertokenisoutdated.1) Ensure yoursessionconfigurationinyourendpointisinamoduleattribute:@session_options[...]2) Change the `plugPlug.Session` tousesaidattribute:plugPlug.Session,@session_options3) Also pass the `@session_options` toyourLiveViewsocket:socket"/live",Phoenix.LiveView.Socket,websocket: [connect_info: [session: @session_options]]4) Define theCSRF meta tag inside the `<head>` taginyourlayout:<%=csrf_meta_tag()%>5) Pass itforwardinyourapp.js:
letcsrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content");
let liveSocket = newLiveSocket("/live",Socket,{params: {_csrf_token: csrfToken}});[info] GET /[debug] Processing withPhoenix.LiveView.Plug.index/2Parameters: %{}Pipelines: [:browser][info] Sent 200in3ms
[info] CONNECTED TO Phoenix.LiveView.Socketin53µsTransport: :websocketSerializer: Phoenix.Socket.V2.JSONSerializerParameters: %{"_csrf_token"=>"QzJ3U1hqG293YQFAF2IJYgNGKX18NTU1qQ150RZB3TYsA2c7f1d89Rel","_mounts"=>"0","_track_static"=>%{"0"=>"http://localhost:4000/css/app.css","1"=>"http://localhost:4000/js/app.js"},"vsn"=>"2.0.0"}
Expected behavior
I don't know whether this is a bug as the "Log out" works and the search in "PageLive" also works without problem.
The text was updated successfully, but these errors were encountered:
goofansu
changed the title
[debug] LiveView session was misconfigured for Google Chrome
[debug] LiveView session was misconfigured for Google Chrome with AdGuard AdBlocker extension installed
Dec 31, 2020
@goofansu just to be clear: if you disable adguard, the issue doesn't happen at all?
In any case, because a logout just happened, this log message may be OK due to the reason in the error message: "the user token is outdated".
Whenever this happens, LiveView will refresh the page so you get an updated token. So because you see a GET request at the end with a CONNECTED message, then it means everything recovered just fine. 👍
I found the problem is caused by the extension: AdGuard AdBlocker.
Environment
Actual behavior
I created an example app here: https://github.com/goofansu/play
FYI, the app is created by following steps:
mix phx.new play --live mix ecto.create # add phx_gen_auth into mix.exs mix deps.get mix compile mix phx.gen.auth Accounts User users mix ecto.migrate
Steps to reproduce the problem:
mix phx.server
[debug] LiveView session was misconfigured...
in the console as followingExpected behavior
I don't know whether this is a bug as the "Log out" works and the search in "PageLive" also works without problem.
The text was updated successfully, but these errors were encountered: