<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[මොනවද මේ JWT කියන්නෙ ?]]></title><description><![CDATA[<p dir="auto">“JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA.”</p>
<p dir="auto"><strong>When to use JWT?</strong></p>
<ul>
<li>
<p dir="auto"><em><strong>Authorization</strong></em>: This is the most common use of jwt. Everytime a user is logged in to the system, a token is generated to the subsequent user. This permits the user to have access to use the routes, services, and resources whenever he needs.</p>
</li>
<li>
<p dir="auto"><em><strong>Information Exchange</strong></em>: JWts are a great way of securely transmitting data between two parties. As the jwts can be signed, for example using public/private keys of each user it is possible to identify whether the senders are people who they say they are. As the signature is calculated using header and a payload it is possible to verify that the content hasn't been tampered with.</p>
</li>
</ul>
<p dir="auto"><strong>What is the JWT structure?</strong></p>
<p dir="auto">JWT consist of three parts separated by dots (.), which are:</p>
<ul>
<li>Header</li>
<li>Payload</li>
<li>Signature</li>
</ul>
<p dir="auto">Therefore, a JWT typically looks like the following.<br />
header.payload.signature</p>
<p dir="auto"><strong>Header</strong></p>
<p dir="auto">Headers consist of type of token which is JWT, and the hashing algorithm such as HS256, HMAC, SHA256 or RSA.</p>
<pre><code>{
  "alg": "HS256",
  "typ": "JWT"
}
</code></pre>
<p dir="auto">Then, the above JSON is Base64Url encoded to form the first part of the JWT.</p>
<p dir="auto"><strong>Payload</strong></p>
<p dir="auto">Payload contains claims which are the information about the entity</p>
<p dir="auto">The JWT specification defines seven claims that can be included in a token. The registered name claims are:</p>
<ul>
<li>iss</li>
<li>sub</li>
<li>aud</li>
<li>exp</li>
<li>nbf</li>
<li>iat</li>
<li>Jti</li>
</ul>
<p dir="auto">You can also use private name claims which is used to convey identity related info such as name or category. When naming these, it is necessary to avoid name collisions because public and private claims are not registered.</p>
<p dir="auto">An example of payload could be:</p>
<pre><code>{
  "sub": "1234567890",
  "name": "John Doe",
  "admin": true
}
</code></pre>
<p dir="auto">The payload is then Base64Url encoded to form the second part of the JSON Web Token.</p>
<p dir="auto"><strong>Signature</strong></p>
<p dir="auto">This is made using the encoded headeer, encoded payload, secret,  the algorithm specified in the header, and sign.</p>
<p dir="auto">The below signature is created using the HMAC SHA256 algorithm.</p>
<pre><code>HMACSHA256(
  base64UrlEncode(header) + "." +
  base64UrlEncode(payload),
  secret)
</code></pre>
<p dir="auto">You can use <a href="https://jwt.io/" target="_blank" rel="noopener noreferrer nofollow ugc">https://jwt.io/</a> whenever you want to check jwt tokens and see the connection between the header, payload, and the signature.</p>
<p dir="auto"><img src="https://cdn.auth0.com/blog/legacy-app-auth/legacy-app-auth-5.png" alt="alt text" class=" img-responsive img-markdown" /></p>
]]></description><link>https://lankadevelopers.lk/topic/132/ම-නවද-ම-jwt-ක-යන-න</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 21:07:17 GMT</lastBuildDate><atom:link href="https://lankadevelopers.lk/topic/132.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 01 Feb 2019 07:24:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Wed, 20 Nov 2019 06:20:57 GMT]]></title><description><![CDATA[<p dir="auto">thanks bro!</p>
]]></description><link>https://lankadevelopers.lk/post/2499</link><guid isPermaLink="true">https://lankadevelopers.lk/post/2499</guid><dc:creator><![CDATA[Ravindu Yasas]]></dc:creator><pubDate>Wed, 20 Nov 2019 06:20:57 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Sat, 23 Feb 2019 13:09:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/117">@Harsha-Sampath</a></p>
<p dir="auto">Ow godak ma ewage security aththema na</p>
]]></description><link>https://lankadevelopers.lk/post/1082</link><guid isPermaLink="true">https://lankadevelopers.lk/post/1082</guid><dc:creator><![CDATA[lkdev]]></dc:creator><pubDate>Sat, 23 Feb 2019 13:09:10 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Wed, 20 Feb 2019 14:25:28 GMT]]></title><description><![CDATA[<p dir="auto">Thanks මචන්. මේවයේ සින්හල version එකකුත් යනවා නම් පට්ට. අපේ ගොඩක් උන් security මුකුත් නැතුව app හදනව ඔවා දන්නේ නැති නිසා.</p>
]]></description><link>https://lankadevelopers.lk/post/1001</link><guid isPermaLink="true">https://lankadevelopers.lk/post/1001</guid><dc:creator><![CDATA[Harsha Sampath]]></dc:creator><pubDate>Wed, 20 Feb 2019 14:25:28 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Tue, 12 Feb 2019 18:17:08 GMT]]></title><description><![CDATA[<p dir="auto">Like to see more of this kind of articles in Sinhla 😊</p>
]]></description><link>https://lankadevelopers.lk/post/933</link><guid isPermaLink="true">https://lankadevelopers.lk/post/933</guid><dc:creator><![CDATA[the_inspired_dev]]></dc:creator><pubDate>Tue, 12 Feb 2019 18:17:08 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Tue, 12 Feb 2019 13:49:01 GMT]]></title><description><![CDATA[<p dir="auto">Great explanation! Keep it up dude.</p>
]]></description><link>https://lankadevelopers.lk/post/932</link><guid isPermaLink="true">https://lankadevelopers.lk/post/932</guid><dc:creator><![CDATA[shehan_s]]></dc:creator><pubDate>Tue, 12 Feb 2019 13:49:01 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Tue, 05 Feb 2019 02:55:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/130">@lkdev</a> thank you I will</p>
]]></description><link>https://lankadevelopers.lk/post/895</link><guid isPermaLink="true">https://lankadevelopers.lk/post/895</guid><dc:creator><![CDATA[Shaavi]]></dc:creator><pubDate>Tue, 05 Feb 2019 02:55:13 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Tue, 05 Feb 2019 02:55:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/2">@dev_lak</a>  thanks a lot</p>
]]></description><link>https://lankadevelopers.lk/post/894</link><guid isPermaLink="true">https://lankadevelopers.lk/post/894</guid><dc:creator><![CDATA[Shaavi]]></dc:creator><pubDate>Tue, 05 Feb 2019 02:55:02 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Tue, 05 Feb 2019 02:54:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/27">@root</a> thanks</p>
]]></description><link>https://lankadevelopers.lk/post/893</link><guid isPermaLink="true">https://lankadevelopers.lk/post/893</guid><dc:creator><![CDATA[Shaavi]]></dc:creator><pubDate>Tue, 05 Feb 2019 02:54:51 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Tue, 05 Feb 2019 02:54:34 GMT]]></title><description><![CDATA[<p dir="auto">@Malith thank you</p>
]]></description><link>https://lankadevelopers.lk/post/892</link><guid isPermaLink="true">https://lankadevelopers.lk/post/892</guid><dc:creator><![CDATA[Shaavi]]></dc:creator><pubDate>Tue, 05 Feb 2019 02:54:34 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Fri, 01 Feb 2019 17:12:46 GMT]]></title><description><![CDATA[<p dir="auto">thnx bro. come with another good article good luck</p>
]]></description><link>https://lankadevelopers.lk/post/872</link><guid isPermaLink="true">https://lankadevelopers.lk/post/872</guid><dc:creator><![CDATA[lkdev]]></dc:creator><pubDate>Fri, 01 Feb 2019 17:12:46 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Fri, 01 Feb 2019 17:12:12 GMT]]></title><description><![CDATA[<p dir="auto">nice explanation</p>
]]></description><link>https://lankadevelopers.lk/post/871</link><guid isPermaLink="true">https://lankadevelopers.lk/post/871</guid><dc:creator><![CDATA[dev_lak]]></dc:creator><pubDate>Fri, 01 Feb 2019 17:12:12 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Fri, 01 Feb 2019 15:19:37 GMT]]></title><description><![CDATA[<p dir="auto">good article. thnx bro</p>
]]></description><link>https://lankadevelopers.lk/post/867</link><guid isPermaLink="true">https://lankadevelopers.lk/post/867</guid><dc:creator><![CDATA[root]]></dc:creator><pubDate>Fri, 01 Feb 2019 15:19:37 GMT</pubDate></item><item><title><![CDATA[Reply to මොනවද මේ JWT කියන්නෙ ? on Fri, 01 Feb 2019 08:44:07 GMT]]></title><description><![CDATA[<p dir="auto">Thanks bro</p>
]]></description><link>https://lankadevelopers.lk/post/861</link><guid isPermaLink="true">https://lankadevelopers.lk/post/861</guid><dc:creator><![CDATA[Nubelle]]></dc:creator><pubDate>Fri, 01 Feb 2019 08:44:07 GMT</pubDate></item></channel></rss>