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
61
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
72
Hardening WordPress is kind of Art
iamchathu
0
140
It's Someone Else's Servers
iamchathu
0
49
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
ローカルで稼働するAI エージェントを超えて / beyond-local-ai-agents
gawa
1
210
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
170
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
3
420
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
180
Nuxt Server Components
wattanx
0
220
それはエンジニアリングの糧である:AI開発のためにAIのOSSを開発する現場より / It serves as fuel for engineering: insights from the field of developing open-source AI for AI development.
nrslib
1
740
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
210
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
350
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.3k
Feature Toggle は捨てやすく使おう
gennei
0
390
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
3
2.6k
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
270
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Paper Plane (Part 1)
katiecoart
PRO
0
6.2k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
110
Ethics towards AI in product and experience design
skipperchong
2
240
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
260
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
140
A Soul's Torment
seathinner
5
2.6k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.4k
エンジニアに許された特別な時間の終わり
watany
106
240k
Deep Space Network (abreviated)
tonyrice
0
98
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
170
New Earth Scene 8
popppiees
2
1.9k
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 !