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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The subject is very broad… I’ve explained before why I think JWTs are useful <a href="https://forum.elixirforum.com/t/to-use-guardian-db-or-not/23617/17" rel="nofollow">here</a> and why they don’t necessarily compare to session cookies.</p>
<p>Just so people don’t get it wrong, OWASP has a dedicated session on JWT (using Java) and considerations one should take into account when using it for authentication (it is <a href="https://cheatsheetseries.owasp.org/cheatsheets/JSON_Web_Token_Cheat_Sheet_for_Java.html" rel="noopener nofollow ugc">here</a>). It also has many considerations for all other kinds of authentication. Even <a href="https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#cookies" rel="noopener nofollow ugc">cookie based session management</a>.</p>
<p>At the same time it <a href="https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html#openid" rel="noopener nofollow ugc">advocates the use of OpenID Connect</a> as a widely adopted specification for identity providers and that protocol uses JWTs a lot. As do OAuth. They are not meant for your use case. Your architecture is a very simple web app that a session cookie might be enough.</p>
<p>In any case, I think that associating JWTs with an authentication system is not correct. I think it is a tool that has use cases as diverse as ensuring a signing and encryption set of algorithms implemented in a wide variety of languages in a variety of libraries.</p>
<p>But just to reiterate: your use case is simple and an HTTP session cookie with any opaque id (shouldn’t be guessable by the frontend) with httpOnly flag set is good enough security (nothing is 100% safe anyway). For other cases with distributed services that won’t be enough in my humble opinion. Nonetheless, you shouldn’t start with an OAuth/OpenID server if you don’t really know you are going to need 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="138280" data-batch-url="/posts/batch_likers">
                        2
                      </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/gaining-an-understanding-of-session-cookies-and-jwt-token/24304/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-138280" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="138280"
                     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 #21"></div>
  </section>
</div>
    <div class="postbit" id="138294" data-post-id="138294">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>One more nail in the coffin with an opinionated video:</p>
<p><strong>JSON Web Tokens Suck - Randall Degges (DevNet Create 2018)</strong></p>
<div class="youtube-onebox lazy-video-container" data-video-id="JdGOb7AxUo0" data-video-title="JSON Web Tokens Suck - Randall Degges (DevNet Create 2018)" data-video-start-time="" data-provider-name="youtube">
  <a href="https://www.youtube.com/watch?v=JdGOb7AxUo0" target="_blank" class="video-thumbnail" rel="noopener nofollow ugc">
    <img class="youtube-thumbnail" src="https://img.youtube.com/vi/JdGOb7AxUo0/maxresdefault.jpg" title="JSON Web Tokens Suck - Randall Degges (DevNet Create 2018)" width="690" height="388">
  </a>
</div>

<aside class="quote no-group" data-username="Yama" data-post="15" data-topic="24304">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/y/c89c15/48.png" class="avatar"> Yama:</div>
<blockquote>
<p>The more I read, the less I understand the reason behind JWT.</p>
</blockquote>
</aside>
<p>As the presenter says at the end, it became popular mainly because of trendiness (and also in my opinion because neither authorization servers and API managers can manage states properly). The identity and access management guys were just bored <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> Even JWT use in OAuth2 is often questionable and risky.</p>
<p>But for authenticated session you better stick to plain good old cookies.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="138294" 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/gaining-an-understanding-of-session-cookies-and-jwt-token/24304/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-138294" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="138294"
                     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 #22"></div>
  </section>
</div>
    <div class="postbit" id="138297" data-post-id="138297">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="wolfiton" data-post="16" data-topic="24304">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wolfiton/48/15884_2.png" class="avatar"> wolfiton:</div>
<blockquote>
<p>So maybe just use the cookie server side and when the client goes in pwa(offline) let it be and verify everything once it gets online again might be a better option.</p>
<p>Have you encountered this type of solution is it achievable?</p>
</blockquote>
</aside>
<p>Can the above statement be achievable using the cookie method I described <a class="mention" href="/u/tangui" rel="nofollow">@tangui</a>?</p>
<p>Or is there a better solution for this?</p>
<p>Thanks in advance</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="138297" 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/gaining-an-understanding-of-session-cookies-and-jwt-token/24304/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-138297" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="138297"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>