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
0
61
Properly Securing Node.js APIs
Properly securing Node.js APIs at WebWeekend Kathmandu #WWKTM .
Chathu Vishwajith
September 22, 2018
Tweet
Share
More Decks by Chathu Vishwajith
See All by Chathu Vishwajith
Lerna and Monorepo architecture for JavaScript
iamchathu
0
69
Hardening WordPress is kind of Art
iamchathu
0
130
It's Someone Else's Servers
iamchathu
0
48
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
2026年 エンジニアリング自己学習法
yumechi
0
120
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.2k
CSC307 Lecture 02
javiergs
PRO
1
770
MUSUBIXとは
nahisaho
0
110
ゆくKotlin くるRust
exoego
1
220
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
0
150
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
280
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
630
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
100
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
200
Implementation Patterns
denyspoltorak
0
270
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
225
10k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
71
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
100
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
150
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
120
New Earth Scene 8
popppiees
1
1.5k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
720
How GitHub (no longer) Works
holman
316
140k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
110
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
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 !