Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Properly Securing Node.js APIs
Search
Chathu Vishwajith
September 22, 2018
Programming
63
0
Share
Properly Securing Node.js APIs
Properly securing Node.js APIs at WebWeekend Kathmandu #WWKTM .
Chathu Vishwajith
September 22, 2018
More Decks by Chathu Vishwajith
See All by Chathu Vishwajith
Lerna and Monorepo architecture for JavaScript
iamchathu
0
73
Hardening WordPress is kind of Art
iamchathu
0
140
It's Someone Else's Servers
iamchathu
0
50
Hardening WordPress is An Art
iamchathu
0
150
Speed Up Your WordPess
iamchathu
0
120
CMBJS Meetup: Securing NodeJS APIs with JWT
iamchathu
0
110
Other Decks in Programming
See All in Programming
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.2k
Road to RubyKaigi: Play Hard(ware)
makicamel
1
550
Are We Really Coding 10× Faster with AI?
kohzas
0
130
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
370
【26新卒研修資料】TDD実装演習
dip_tech
PRO
0
170
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.6k
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
390
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
320
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
120
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
490
Terraform言語の静的解析 / static analysis of Terraform language
wata727
1
140
Featured
See All Featured
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
340
Believing is Seeing
oripsolob
1
120
Skip the Path - Find Your Career Trail
mkilby
1
120
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
1
33
Music & Morning Musume
bryan
47
7.2k
Navigating Weather and Climate Data
rabernat
0
190
Game over? The fight for quality and originality in the time of robots
wayneb77
1
170
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
260
The Curse of the Amulet
leimatthew05
1
12k
Transcript
WebWeekend Kathmandu
Perfectly Securing Node.js APIs
Who am I Chathu Vishwajith Auth0 Ambassador Co-Founder of a
startup From Sri Lanka !
?
Cookie vs Tokens
Cookie vs Tokens
Cookie Tokens Statefull Stateless Performance Decoupled
Advantages of JWT → Stateless → Scalable → Decoupled
Advantages of JWT (Cont) → Cross-Domain → CORS
Use cases JWT (Cont) → Back-end APIs → Serverless Applications
→ IOT Devices → Mobile Applications
Things to Remember → JWTs are encoded not encrypted! →
This does not mean they can modify it though, even the slightest change will invalidate the token → Do not store sensitive information within a JWT. → Solution: JSON Web Encryption allows you to safely encrypt the claims of a token
JWT Token Structure header.payload.signature
Header Type of token and hashing algorithm → HMAC →
ECDSA → RSA
Payload Your Token Payload
Signature Verification of Token
Libraries Almost all languages has JWT implementation.
How to use JWT
Install JWT Library For Node.js and Express.js
Create JWT
Verify JWT
Organizing code → Module based approach. → Configuration in files.
→ Auto load models and routes. → Keep your secret secret.
Config file Keep all changing config strings in one place.
.env file we use dotenv to load .env file.
Shall we move to code work though?
Summery → Some APIs needs to secure → Cookie vs
Tokens → JWT is Stateless, Scalable, Decoupled → How to use JWT with Node.js
Code repository https://github.com/iamchathu/nodejs-api-starter
More Reading https://chathu.me/2017/08/28/jwt-introduction/
None
Thank you !