Vikas Rajput Profile picture
May 15, 2023 9 tweets 3 min read Read on X
JWT is now become the de-facto standard for authenticating Modern APIs.

This guide will make it dead simple for you to understand JWT:
1. JWT stands for JSON Web Token
2. It's a token that is used to authenticate and authorize users in an application.

"authenticate" means who they're.
"authorize" means what they can access.

The token itself contains, all the necessary information about the user, like user ID and role, etc, in a JSON.
3. JWT tokens are typically generated by the server and sent to the client after a successful login.

The client can then use the JWT token (with each request) to authenticate and authorize itself to the server.

Typically the token looks like this: Image
4. JWT has three parts:

a) Header (highlighted in red below)
b) Payload (highlighted in pink below)
c) Signature (highlighted in blue below)

On left you can see the encoded token, on right we can see decoded JSON object with 3 parts. Image
The header typically consists of two parts: the type of the token, which is usually JWT, and the signing algorithm being used, such as HMAC SHA256 or RSA. Image
The payload contains the claims, which are statements about an entity (typically, the user) and additional metadata.

Claims are typically represented as key-value pairs and can include information such as the user's ID, name, email, and roles. Image
The signature is used to verify that the sender of the JWT is who it says it is and to ensure that the message has not been tampered with. Image
That's a quick introduction to JWT!

Follow me @vikasrajputin for more.

If you find this thread helpful then Like/Retweet the first tweet below:

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Vikas Rajput

Vikas Rajput Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @vikasrajputin

Apr 6, 2024
Mastering docker will be your best decision as a backend engineer.

But getting started with docker, can be super intimidating.

Here's a 2 min guide, to quickly understand docker and why is it used so widely:
𝟭. 𝗣𝗿𝗼𝗯𝗹𝗲𝗺 𝗦𝗼𝗹𝘃𝗲𝗱 𝗯𝘆 𝗗𝗼𝗰𝗸𝗲𝗿

- Building and Deploying an application is always a challenge for programmers. Specially if you're programming on different OS and deploying on server with different OS.

- There's always a chance of human error causing our application to not work on remote servers.

- This problem becomes even worse when we're working on real world application with tons of module, DB, third party integrations, environment specific configuration.

- This is where docker enters into the picture:
𝟮. 𝗗𝗲𝗳𝗶𝗻𝗶𝘁𝗶𝗼𝗻

- Docker allows developers to build, package, and deploy applications in a consistent and efficient way.

- It provides an easy way to create isolated environments for applications, which can help to avoid conflicts and compatibility issues.
Read 6 tweets
Apr 3, 2024
SQL Indexing is one of the most important ways of improving a query performance

Mostly there're 2 types of Indexes:

1) Clustered Index
2) Non-Clustered Index

Here's what it means in the simplest terms:
1. Clustered index

It's a special type of index that reorders the way records in the table are physically stored.

This means that the data rows are stored in the same order as the index.

There can only be one clustered index per table.
For eg:

"Employees" table has fields "ID", "Name", and "Department".

If we create a clustered index on the "ID" field, the data rows will be physically stored in the table in ascending order by "ID".

This can be useful for quickly finding specific records based on "ID".
Read 10 tweets
Mar 29, 2024
SQL Indexing in a Nutshell:
1. Introduction

It is a technique, using which we can improve search performance in our database.

When we search for any record in DB, it goes to the index, finds the exact location of the record, skips the unnecessary records in between, and quickly gives us the results.
2. Example

As shown in the diagram, consider a table PRODUCT with ID as the primary key.

Let's say you want to find a product with the 'ID' of 104.

Without indexing, the database would look through each row, one by one, until it finds the product that will fetch results slowly
Read 7 tweets
Mar 25, 2024
No matter if you're learning SQL for Data Science or Software Development.

You should master SQL "Normalization".

Here's a simple guide to get you started:
1. Introduction

Normalization is a process to eliminate redundant data, prevent data anomalies, and ensure data integrity.

It makes your life super easy to manage, store and query data effectively in longer run!

Normalization happens in multiple stages:

1NF, 2NF, 3NF
2. Realworld Example

To understand normalization, let's consider a simple restaurant database example.

We have one table "Orders" with columns: OrderID, CustomerName, Dish, Chef, DishType, Price. Image
Read 11 tweets
Mar 13, 2024
To master docker, you need to have a solid understanding of how docker volume works.

Here's a quick guide to help you understand everything about volumes:
1. Introduction to volumes

Docker volumes are the preferred mechanism for persisting data generated and used by docker containers.

Think of it as an external hard drive you plug into multiple computers (containers).
2. Why need volumes?

Containers are temporary while data is permanent.

Volumes protect data even if a container dies.

Without volumes:
• Data in containers is lost when the container is killed.
• Sharing data among different containers becomes difficult.
Read 7 tweets
Mar 11, 2024
It took me 10 years to learn this, but let me teach it to you in the next 5 minutes.

It completely changed my life as a programmer: Image
1. ASK Questions

- No matter how dumb you sound

- No matter how silly that question is

Just ASK

- Don't assume anything, have absolute clarity of your work before you start.

- A minor communication gap will ruin your entire hard work so keep asking questions.
2. Don't jump straight into coding

- Pick a pen and paper, and solve it first.

- Understand how the data is flowing in your code.

- Analyse every aspect of the given functionality.

- See if it impacts other modules.
Read 13 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(