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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Chathu Vishwajith
September 22, 2018
Programming
64
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
81
Hardening WordPress is kind of Art
iamchathu
0
140
It's Someone Else's Servers
iamchathu
0
58
Hardening WordPress is An Art
iamchathu
0
160
Speed Up Your WordPess
iamchathu
0
120
CMBJS Meetup: Securing NodeJS APIs with JWT
iamchathu
0
120
Other Decks in Programming
See All in Programming
Foundation Models frameworkで画像分析
ryodeveloper
1
570
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
410
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
840
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
1
230
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
210
OpenSpecのproposalにbrainstormingを持たせてみた
tigertora7571
1
200
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
460
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
570
テーブルをDELETEした
yuzneri
0
130
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
210
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
580
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
450
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
380
WENDY [Excerpt]
tessaabrams
11
39k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
240
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
920
Art, The Web, and Tiny UX
lynnandtonic
304
22k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
RailsConf 2023
tenderlove
30
1.5k
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 !