<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="167566" data-post-id="167566">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tfwright" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/120/20299_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tfwright
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>No I never pursued a solution. I’m pretty sure what I suggested above is <em>possible</em> but I’m not really sure it’s best practice.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="167566" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-167566" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="167566"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="167649" data-post-id="167649">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mindok" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mindok/120/13538_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mindok
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Ok, thanks. I know who my users are so I’ll just write a home-made user state store with updates straight from the liveviews.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="167649" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-167649" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="167649"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="170371" data-post-id="170371">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="shahryarjb" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shahryarjb/120/39485_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  shahryarjb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>i’m confused, we put session with normal redirect to live router? and add session on live router ? that’s it? like</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"> live "/foo", FooLiveView, session: [:user_id]
</code></pre>
<p>it’s oky, but how can update phoenix session in phoenix liveview, becuase I used Oauth2 protocol, and every request I have to send <code>refresh_token</code> and <code>access_token</code>, and update new refresh_token after this. but I’m using Liveview, how can I do? I just can create a normal router which is <code>AuthController</code> but all of my pages are <code>Phoenix liveview</code></p>
<p>and I have one more question, we have to pass new token every page ? in Liveview ? what about after updating session ?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="170371" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-170371" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="170371"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="181372" data-post-id="181372">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="toranb" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/toranb/120/16117_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  toranb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I realize I’m really /really/ late to the party but I did blog up a solution I put together for login &amp; signup forms in Phoenix LiveView if anyone is still hunting around for options</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://toranbillups.com/blog/archive/2020/06/26/cookie-authentication-with-phoenix-liveview/">
  <header class="source">

      <a href="https://toranbillups.com/blog/archive/2020/06/26/cookie-authentication-with-phoenix-liveview/" target="_blank" rel="noopener nofollow ugc">toranbillups.com</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://toranbillups.com/blog/archive/2020/06/26/cookie-authentication-with-phoenix-liveview/" target="_blank" rel="noopener nofollow ugc">Cookie Authentication with Phoenix LiveView</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="181372" data-batch-url="/posts/batch_likers">
                        8
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-181372" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="181372"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="181411" data-post-id="181411">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="henrik" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/henrik/120/4340_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  henrik
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>And I’ve blogged about storing data in the session in LiveView: <a href="https://thepugautomatic.com/2020/05/persistent-session-data-in-phoenix-liveview/" class="inline-onebox" rel="noopener nofollow ugc">Persistent session data in Phoenix LiveView – The Pug Automatic</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="181411" data-batch-url="/posts/batch_likers">
                        5
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-181411" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="181411"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="186819" data-post-id="186819">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ricardo-h" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ricardo-h/120/8947_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ricardo-h
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It seems that there is still no consensus pattern to solve the state management with liveview.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="186819" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-186819" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="186819"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="193541" data-post-id="193541">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kuon" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kuon/120/36090_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kuon
                      <span class="op-star" title="Thread Starter">
                        <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                      </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>My solution was to create the login form in a live view, and when the login succeed, I generate a phoenix token and I redirect to <code>/login/:token</code> with a <code>redirect</code> in the live view, <code>/login/:token</code> is a normal controller that check the token and use <code>put_session</code> on the <code>conn</code> as usual.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="193541" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-193541" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="193541"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="202002" data-post-id="202002">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="slashmili" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/slashmili/120/1047_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  slashmili
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><strong>TL;DR</strong>: use <a href="https://hexdocs.pm/phoenix_live_view/form-bindings.html#submitting-the-form-action-over-http" rel="noopener nofollow ugc">phx_trigger_action</a></p>
<p>I’ve came across this thread multiple times past few months while I was looking for a solution, I was about to implement the workaround that people are offering(calling an API to set session) here but I learned about <a href="https://hexdocs.pm/phoenix_live_view/form-bindings.html#submitting-the-form-action-over-http" rel="noopener nofollow ugc">phx_trigger_action</a> attributes for form bindings.</p>
<blockquote>
<p>The <code>phx-trigger-action</code> attribute can be added to a form to trigger a standard form submit on DOM patch to the URL specified in the form’s standard <code>action</code> attribute. This is useful to perform pre-final validation of a LiveView form submit before posting to a controller route for operations that require Plug session mutation.</p>
</blockquote>
<p>Kudo goes to <a href="https://pragmaticstudio.com/courses/phoenix-liveview" rel="noopener nofollow ugc">Pragmatic Studio’s Phoenix LiveView couse</a>. I highly recommend it!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="202002" data-batch-url="/posts/batch_likers">
                        13
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-202002" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="202002"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="228436" data-post-id="228436">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="shahryarjb" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shahryarjb/120/39485_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  shahryarjb
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="slashmili" data-post="19" data-topic="21196">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/slashmili/48/1047_2.png" class="avatar"> slashmili:</div>
<blockquote>
<p>Kudo goes to <a href="https://pragmaticstudio.com/courses/phoenix-liveview" rel="noopener nofollow ugc">Pragmatic Studio’s Phoenix LiveView couse </a>. I highly recommend it!</p>
</blockquote>
</aside>
<p>when you use this you have this problem <a href="https://forum.elixirforum.com/t/bug-in-navigating-from-a-controller-to-a-liveview-page-put-flash-message-will-not-be-deleted/42808/3" rel="nofollow">Bug in navigating from a controller to a LiveView page (put_flash message will not be deleted)</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="228436" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-228436" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="228436"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="230867" data-post-id="230867">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="daveboo" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  daveboo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This seems too good/simple to be true…did you have any trouble down the road using this approach?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="230867" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-to-manage-session-state-with-live-view/21196/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-230867" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="230867"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/21196/load_more?page=3">Load more posts</a>
</div></template></turbo-stream>