SlideShare a Scribd company logo
Secure API Services in Node.js
Welcome!
• Agenda
• Stormpath 101 (5 mins)
• How to secure an API (25 mins)
• Q&A (30 mins)
• Claire Hunsaker
VP of Marketing & Customer Success
• Randall Degges
Node.js Evangelist
Customer Identity Poses Major Challenges
Speed to Market & Cost Reduction
• Complete Identity solution out-of-the-box
• Security best practices and updates by default
• Clean & elegant API/SDKs
• Little to code, no maintenance
Focus on Your Core Competency
Stormpath User Management
User Data
User
Workflows Google ID
Your Applications
Application SDK
Application SDK
Application SDK
ID Integrations
Facebook
Active
Directory
SAML
Features
• Secure, flexible Authentication
(Password, Token, OAuth, API)
• Deep Authorization
Groups, Roles
Customer Organizations
Permissions
• Customer Profile Data
• Single Sign-On Across Your Apps
• Hosted User Screens
What’s the Goal of This Talk?
D’oh!
API Server(s)API Client
API Client
API Client
API Client
Internet
API Server(s)API Server(s)
Browser / Mobile
Web
API Client
Client-to-API Server-to-API
Basic Auth OAuth2
What’s the Goal of This Talk?
About API Keys…
randall@stormpath.com
iLOVEc00kies!
API Server(s)Website
163e087c36c34fa4b4635995c29cf9b5:b6e7bd4c74cf430493fe03b2e30225f8
API Secret
Long, random strings (uuids).
Let Users Have Multiple API Keys
Key 1 Key 2
ID: 3c511ea2ef424dd88bc1575e7e5a2bd7
Secret: 1ae8120c1ec940638913f4e258b8f7fe
ID: cc463f7aabfd4132a2211006886d05f1
Secret: 85172ea5aef144038f019b3111b5e11a
Creating API Keys with Stormpath
req.user.createApiKey(function(err, apiKey) {
if (err) throw err;
console.log('New API key created!');
console.log('API Key ID:', apiKey.id);
console.log('API Key Secret:',
apiKey.secret);
});
LET’S SET UP STORMPATH!
LET’S WRITE SOME CODE!
How Does Basic Auth Work?
API Server(s)
Authorization: Basic <base64(id:secret)>
$ curl --user id:secret http://localhost:3000/api/test
How Does OAuth2 Work? (Step 1)
API Server(s)
Authorization: Basic <base64(id:secret)>
Access Token
$ curl --user id:secret 
-X POST 
--data grant_type=client_credentials 
http://localhost:3000/oauth/token
How Does OAuth2 Work? (Step 2)
API Server(s)
Authorization: Bearer <token>
$ curl -H “Authorization: Bearer <token>” 
http://localhost:3000/api/test
Node & Express Resources
• Talking to OAuth2 Services with Node.js
https://stormpath.com/blog/talking-to-oauth2-services-with-nodejs
• What the Heck is OAuth?
https://stormpath.com/blog/what-the-heck-is-oauth/
• Stormpath Express Library
http://docs.stormpath.com/nodejs/express/latest/
• All Our JavaScript Integrations
http://docs.stormpath.com/nodejs/
QUESTIONS?
THANK YOU

More Related Content

What's hot (20)

PPTX
Token Authentication for Java Applications
Stormpath
 
PPTX
Browser Security 101
Stormpath
 
PDF
Authentication: Cookies vs JWTs and why you’re doing it wrong
Derek Perkins
 
PPTX
Single-Page-Application & REST security
Igor Bossenko
 
PPTX
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...
CA API Management
 
PDF
Super simple application security with Apache Shiro
Marakana Inc.
 
PPTX
Secure Your REST API (The Right Way)
Stormpath
 
PDF
ConFoo 2015 - Securing RESTful resources with OAuth2
Rodrigo Cândido da Silva
 
PPTX
Api security
teodorcotruta
 
PPTX
ApacheCon 2014: Infinite Session Clustering with Apache Shiro & Cassandra
DataStax Academy
 
PDF
JavaOne 2014 - Securing RESTful Resources with OAuth2
Rodrigo Cândido da Silva
 
PPTX
Rest API Security
Stormpath
 
PPTX
Best Practices in Building an API Security Ecosystem
Prabath Siriwardena
 
PDF
JWTs in Java for CSRF and Microservices
Stormpath
 
PPTX
Spring Security
Manish Sharma
 
PPTX
Enabling Cloud Native Security with OAuth2 and Multi-Tenant UAA
Will Tran
 
PPTX
Intro to Apache Shiro
Claire Hunsaker
 
PPTX
D@W REST security
Gaurav Sharma
 
PPTX
Instant Security & Scalable User Management with Spring Boot
Stormpath
 
PPTX
Securing RESTful APIs using OAuth 2 and OpenID Connect
Jonathan LeBlanc
 
Token Authentication for Java Applications
Stormpath
 
Browser Security 101
Stormpath
 
Authentication: Cookies vs JWTs and why you’re doing it wrong
Derek Perkins
 
Single-Page-Application & REST security
Igor Bossenko
 
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...
CA API Management
 
Super simple application security with Apache Shiro
Marakana Inc.
 
Secure Your REST API (The Right Way)
Stormpath
 
ConFoo 2015 - Securing RESTful resources with OAuth2
Rodrigo Cândido da Silva
 
Api security
teodorcotruta
 
ApacheCon 2014: Infinite Session Clustering with Apache Shiro & Cassandra
DataStax Academy
 
JavaOne 2014 - Securing RESTful Resources with OAuth2
Rodrigo Cândido da Silva
 
Rest API Security
Stormpath
 
Best Practices in Building an API Security Ecosystem
Prabath Siriwardena
 
JWTs in Java for CSRF and Microservices
Stormpath
 
Spring Security
Manish Sharma
 
Enabling Cloud Native Security with OAuth2 and Multi-Tenant UAA
Will Tran
 
Intro to Apache Shiro
Claire Hunsaker
 
D@W REST security
Gaurav Sharma
 
Instant Security & Scalable User Management with Spring Boot
Stormpath
 
Securing RESTful APIs using OAuth 2 and OpenID Connect
Jonathan LeBlanc
 

Viewers also liked (15)

PDF
Building Beautiful REST APIs in ASP.NET Core
Stormpath
 
PPTX
Storing User Files with Express, Stormpath, and Amazon S3
Stormpath
 
PPTX
Building Secure User Interfaces With JWTs (JSON Web Tokens)
Stormpath
 
PPTX
Custom Data Search with Stormpath
Stormpath
 
PPTX
Stormpath 101: Spring Boot + Spring Security
Stormpath
 
PPTX
Spring Boot Authentication...and More!
Stormpath
 
PPTX
Beautiful REST+JSON APIs with Ion
Stormpath
 
PPTX
Build a Node.js Client for Your REST+JSON API
Stormpath
 
PPTX
So long scrum, hello kanban
Stormpath
 
PPTX
Elegant Rest Design Webinar
Stormpath
 
PPTX
Build A Killer Client For Your REST+JSON API
Stormpath
 
PPTX
REST API Design for JAX-RS And Jersey
Stormpath
 
PDF
Getting Started With Angular
Stormpath
 
PDF
Build a REST API for your Mobile Apps using Node.js
Stormpath
 
PDF
Building Beautiful REST APIs with ASP.NET Core
Stormpath
 
Building Beautiful REST APIs in ASP.NET Core
Stormpath
 
Storing User Files with Express, Stormpath, and Amazon S3
Stormpath
 
Building Secure User Interfaces With JWTs (JSON Web Tokens)
Stormpath
 
Custom Data Search with Stormpath
Stormpath
 
Stormpath 101: Spring Boot + Spring Security
Stormpath
 
Spring Boot Authentication...and More!
Stormpath
 
Beautiful REST+JSON APIs with Ion
Stormpath
 
Build a Node.js Client for Your REST+JSON API
Stormpath
 
So long scrum, hello kanban
Stormpath
 
Elegant Rest Design Webinar
Stormpath
 
Build A Killer Client For Your REST+JSON API
Stormpath
 
REST API Design for JAX-RS And Jersey
Stormpath
 
Getting Started With Angular
Stormpath
 
Build a REST API for your Mobile Apps using Node.js
Stormpath
 
Building Beautiful REST APIs with ASP.NET Core
Stormpath
 
Ad

Similar to Secure API Services in Node with Basic Auth and OAuth2 (20)

PPT
Securing RESTful API
Muhammad Zbeedat
 
PDF
Protecting Your APIs Against Attack & Hijack
CA API Management
 
PPTX
API Services: Building State-of-the-Art APIs
Apigee | Google Cloud
 
PDF
2022 APIsecure_Securing Large API Ecosystems
APIsecure_ Official
 
PPTX
REST API Design & Development
Ashok Pundit
 
PDF
Apidays Paris 2023 - Securing Microservice-based APIs, Michal Trojanowski, Cu...
apidays
 
PPTX
Rest API Security - A quick understanding of Rest API Security
Mohammed Fazuluddin
 
PDF
A Complete Guide to Node.js Authentication and Security
Naresh IT
 
PPTX
Unit 3_detailed_automotiving_mobiles.pptx
VijaySasanM21IT
 
PDF
CIS14: Best Practices You Must Apply to Secure Your APIs
CloudIDSummit
 
PPTX
Beautiful REST and JSON APIs - Les Hazlewood
jaxconf
 
PPTX
Restful api
Anurag Srivastava
 
PPTX
Enterprise Access Control Patterns for REST and Web APIs Gluecon 2011, Franco...
CA API Management
 
PPTX
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
CA API Management
 
PPTX
vogler good section Presentation.pptx
voglerazariah1
 
PDF
APIDays Paris Security Workshop
42Crunch
 
PDF
Securing Your API
Jason Austin
 
PPTX
APIs: The New Security Layer
Apigee | Google Cloud
 
PDF
Checkmarx meetup API Security - API Security top 10 - Erez Yalon
Adar Weidman
 
PDF
LF_APIStrat17_OWASP’s Latest Category: API Underprotection
LF_APIStrat
 
Securing RESTful API
Muhammad Zbeedat
 
Protecting Your APIs Against Attack & Hijack
CA API Management
 
API Services: Building State-of-the-Art APIs
Apigee | Google Cloud
 
2022 APIsecure_Securing Large API Ecosystems
APIsecure_ Official
 
REST API Design & Development
Ashok Pundit
 
Apidays Paris 2023 - Securing Microservice-based APIs, Michal Trojanowski, Cu...
apidays
 
Rest API Security - A quick understanding of Rest API Security
Mohammed Fazuluddin
 
A Complete Guide to Node.js Authentication and Security
Naresh IT
 
Unit 3_detailed_automotiving_mobiles.pptx
VijaySasanM21IT
 
CIS14: Best Practices You Must Apply to Secure Your APIs
CloudIDSummit
 
Beautiful REST and JSON APIs - Les Hazlewood
jaxconf
 
Restful api
Anurag Srivastava
 
Enterprise Access Control Patterns for REST and Web APIs Gluecon 2011, Franco...
CA API Management
 
Best Practices You Must Apply to Secure Your APIs - Scott Morrison, SVP & Dis...
CA API Management
 
vogler good section Presentation.pptx
voglerazariah1
 
APIDays Paris Security Workshop
42Crunch
 
Securing Your API
Jason Austin
 
APIs: The New Security Layer
Apigee | Google Cloud
 
Checkmarx meetup API Security - API Security top 10 - Erez Yalon
Adar Weidman
 
LF_APIStrat17_OWASP’s Latest Category: API Underprotection
LF_APIStrat
 
Ad

Recently uploaded (20)

PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PPTX
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PDF
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
PDF
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
PDF
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
PPTX
The birth and death of Stars - earth and life science
rizellemarieastrolo
 
PDF
Bridging CAD, IBM TRIRIGA & GIS with FME: The Portland Public Schools Case
Safe Software
 
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
PDF
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
Fwdays
 
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Proactive Server and System Monitoring with FME: Using HTTP and System Caller...
Safe Software
 
Practical Applications of AI in Local Government
OnBoard
 
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
The birth and death of Stars - earth and life science
rizellemarieastrolo
 
Bridging CAD, IBM TRIRIGA & GIS with FME: The Portland Public Schools Case
Safe Software
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 

Secure API Services in Node with Basic Auth and OAuth2

  • 1. Secure API Services in Node.js
  • 2. Welcome! • Agenda • Stormpath 101 (5 mins) • How to secure an API (25 mins) • Q&A (30 mins) • Claire Hunsaker VP of Marketing & Customer Success • Randall Degges Node.js Evangelist
  • 3. Customer Identity Poses Major Challenges
  • 4. Speed to Market & Cost Reduction • Complete Identity solution out-of-the-box • Security best practices and updates by default • Clean & elegant API/SDKs • Little to code, no maintenance Focus on Your Core Competency
  • 5. Stormpath User Management User Data User Workflows Google ID Your Applications Application SDK Application SDK Application SDK ID Integrations Facebook Active Directory SAML
  • 6. Features • Secure, flexible Authentication (Password, Token, OAuth, API) • Deep Authorization Groups, Roles Customer Organizations Permissions • Customer Profile Data • Single Sign-On Across Your Apps • Hosted User Screens
  • 7. What’s the Goal of This Talk?
  • 8. D’oh! API Server(s)API Client API Client API Client API Client Internet
  • 9. API Server(s)API Server(s) Browser / Mobile Web API Client Client-to-API Server-to-API
  • 10. Basic Auth OAuth2 What’s the Goal of This Talk?
  • 14. Let Users Have Multiple API Keys Key 1 Key 2 ID: 3c511ea2ef424dd88bc1575e7e5a2bd7 Secret: 1ae8120c1ec940638913f4e258b8f7fe ID: cc463f7aabfd4132a2211006886d05f1 Secret: 85172ea5aef144038f019b3111b5e11a
  • 15. Creating API Keys with Stormpath req.user.createApiKey(function(err, apiKey) { if (err) throw err; console.log('New API key created!'); console.log('API Key ID:', apiKey.id); console.log('API Key Secret:', apiKey.secret); });
  • 16. LET’S SET UP STORMPATH!
  • 18. How Does Basic Auth Work? API Server(s) Authorization: Basic <base64(id:secret)> $ curl --user id:secret http://localhost:3000/api/test
  • 19. How Does OAuth2 Work? (Step 1) API Server(s) Authorization: Basic <base64(id:secret)> Access Token $ curl --user id:secret -X POST --data grant_type=client_credentials http://localhost:3000/oauth/token
  • 20. How Does OAuth2 Work? (Step 2) API Server(s) Authorization: Bearer <token> $ curl -H “Authorization: Bearer <token>” http://localhost:3000/api/test
  • 21. Node & Express Resources • Talking to OAuth2 Services with Node.js https://stormpath.com/blog/talking-to-oauth2-services-with-nodejs • What the Heck is OAuth? https://stormpath.com/blog/what-the-heck-is-oauth/ • Stormpath Express Library http://docs.stormpath.com/nodejs/express/latest/ • All Our JavaScript Integrations http://docs.stormpath.com/nodejs/