{"data":{"markdownRemark":{"html":"<p>JSON web tokens are text strings that can be used by a client and server to authenticate and share information easily. The main purpose of JWT is not to hide data, it is to help a server remember who somebody is and that the data was sent by an authentic source.</p>\n<p>JWTs are stateless which means no user information needs to be stored on the server-side. The user information is stored in the JWT. The information embedded in a JWT will typically be: the user’s first and last name, user’s email address or username, user’s ID and user’s permissions.</p>\n<p>The data inside a JWT is encoded and signed and can also be encrypted. The purpose of encoding in this case is to transform the data into text that is more easily transmitted across the wire. Signing allows the receiver to verify the authenticity of the source of the data. Encrypting changes the data so that only people that have access to a secret key can read it.</p>\n<p>Some of the pros and cons of using a JSON Web Token are:\nPros:\n</br>1️⃣Scalable - There is no need to store information on the server-side so it is easily scalable because the server does not have to look up user information every time it gets a request.\n</br>2️⃣Extensible - A token can be sent to any domain. You can use the same token to make requests to different domains or downstream services.</p>\n<p>Cons:\n</br>1️⃣Security risk - If your token gets stolen, the attacker has full access to the user’s account. To prevent this, use HTTPS and set a short expiration for the token so that in case it gets compromised, it will be for a limited amount of time.\n</br>2️⃣Large - The size of a JWT can get large depending on how much user information is stored in the token.</p>\n<p>Thank you!</p>\n<h3>#developer #frontenddeveloper #webdeveloper #webdevelopment #codingisfun #worldcode #programmerrepublic #code #programming #website #frontend #backend #codinglife #educateyourself #javascript #js #es6 #webapp #web #buildupdevs #sessionmanagement #cookies #authentication #cybersecurity #fullstackdeveloper #momscancode #computerscience #compsci #coder</h3>","frontmatter":{"path":"/post-token-auth","title":"How Does Token Based Authentication Work?","author":"CodingBeenz","date":"06 May, 2019","featuredImage":{"childImageSharp":{"sizes":{"base64":"data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAUABQDASIAAhEBAxEB/8QAGAABAQEBAQAAAAAAAAAAAAAAAAIDBAX/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAwH/2gAMAwEAAhADEAAAAc9PPtI5Skhtg//EABoQAAIDAQEAAAAAAAAAAAAAAAECAAMxEBL/2gAIAQEAAQUCW1Y9yw3RMJMO8ZvZ/8QAFhEBAQEAAAAAAAAAAAAAAAAAAREg/9oACAEDAQE/AUbj/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPwEf/8QAHRAAAQQCAwAAAAAAAAAAAAAAAAERITICEFGBov/aAAgBAQAGPwI5Klm7Iy9ITt1P/8QAHRAAAgEEAwAAAAAAAAAAAAAAAREAECFRYUGhsf/aAAgBAQABPyEcqADwJct2jIhDCRTm3B3YE5qdMAdBT//aAAwDAQACAAMAAAAQjx8A/8QAGBEAAgMAAAAAAAAAAAAAAAAAATEAEKH/2gAIAQMBAT8QQDTAr//EABQRAQAAAAAAAAAAAAAAAAAAACD/2gAIAQIBAT8QH//EAB0QAQADAAEFAAAAAAAAAAAAAAEAESFhEDFRgZH/2gAIAQEAAT8QMW3zTN+iga0g5jYseoHmNFBbuyJpa9CI+zpaxuiZVT5P/9k=","aspectRatio":1,"src":"/static/6ee69cc2b29d4424f4ef594b17fa4a47/08385/featured-image.jpg","srcSet":"/static/6ee69cc2b29d4424f4ef594b17fa4a47/4a8c6/featured-image.jpg 158w,\n/static/6ee69cc2b29d4424f4ef594b17fa4a47/845c7/featured-image.jpg 315w,\n/static/6ee69cc2b29d4424f4ef594b17fa4a47/08385/featured-image.jpg 630w,\n/static/6ee69cc2b29d4424f4ef594b17fa4a47/7320b/featured-image.jpg 945w,\n/static/6ee69cc2b29d4424f4ef594b17fa4a47/487eb/featured-image.jpg 1080w","sizes":"(max-width: 630px) 100vw, 630px"}}}}}},"pageContext":{"isCreatedByStatefulCreatePages":false}}