SlideShare a Scribd company logo
ULTIMATE GUIDE TO MOBILE
SECURITY
Edward Jiang
HI, I’M
EDWARD!
@EdwardStarcraft
Developer Evangelist @goStormpath
DEVELOPER TOOLS FOR AUTHENTICATION
• Stormpath — Authentication as a Service
• Web Framework Integrations — Authentication in your web framework of choice
• Apache Shiro — Java security framework
• JWTK — JWT libraries for JavaScript & Java
• Simplicity — Easy social login for iOS
• Turnstile — Authentication framework for server-side Swift
USERS STORMPATH INTEGRATIONS
A U T H E N T I C AT I O N
H O W D O E S I T W O R K ?
A U T H E N T I C AT I O N
I T ’ S A B O U T P R O V I N G T H AT Y O U A R E
W H O Y O U S AY Y O U A R E
BASIC AUTHENTICATION
GET / HTTP/1.1
Authorization: Basic Base64(username:password)
• Easy and convenient, but insecure
• Username / password needs to be stored on the device
• Username / password are sent on every request
TOKENIZATION
“myusername” and “mypassword” becomes “rCsspweTxMtz2sypA0PLGns6fkCA”
• No risk of losing the username/password from the device
• Device credentials can be independently revoked from the username/password
COOKIE AUTHENTICATION
GET / HTTP/1.1
Cookie: sessionId=rCsspweTxMtz2sypA0PLGns6fkCA
• Convenient: the server sets a cookie, and the HTTP Client automatically takes care of
authentication
• Server-side logic for authentication can be shared between mobile and web
• Downside: hard to understand state
BEARER AUTHENTICATION
GET / HTTP/1.1
Authorization: Bearer rCsspweTxMtz2sypA0PLGns6fkCA
• Slightly more complicated: Need to write an endpoint, and a format for the client to
understand
• Need to deal with storing the token (use the iOS Keychain or Android
SharedPreferences)
• But ultimate control over token usage, and state. Preferred method
STATELESS TOKENS
• Used at scale in larger APIs
• Self contained, unlike “dumb” / opaque tokens
• Can be validated easily without a round trip to a central database
• Harder to use properly
JSON WEB TOKEN
eyJrafea.eyJzdWIiopkIefwEWFd.dPPxume
Header Body Signature
{
"sub": "1234567890",
"name": "John Doe",
"iat": 1487260586,
"exp": 1487264186
}
{
"typ": "JWT",
"alg": "HS256"
}
STORMPATH MOBILE SDKS
• Uses the Stormpath API to authenticate users & validate their identity
• Authenticate to your APIs with Bearer Authentication
• Use JWTs for scalability
LET’S SEE SOME CODE!
FINISHED RESULT
• GitHub: https://github.com/stormpath/stormpath-ios-example
• Review this tutorial: https://stormpath.com/blog/build-note-taking-app-swift-ios
WHAT NEXT?
• Try the Android counterpart: https://stormpath.com/blog/build-user-authentication-for-
android-app
• Learn how to build a REST API for mobile: https://stormpath.com/blog/tutorial-build-rest-
api-mobile-apps-using-node-js
• Talk to us! Email support@stormpath.com, or edward@stormpath.com
• Follow us @EdwardStarcraft and @goStormpath on Twitter
QUESTIONS?

More Related Content

What's hot (20)

PDF
Securing Web Applications with Token Authentication
Stormpath
 
PPTX
Best Practices in Building an API Security Ecosystem
Prabath Siriwardena
 
PDF
JavaOne 2014 - Securing RESTful Resources with OAuth2
Rodrigo Cândido da Silva
 
PPTX
Secure Your REST API (The Right Way)
Stormpath
 
PDF
Protecting Your APIs Against Attack & Hijack
CA API Management
 
PPTX
Securing Single Page Applications with Token Based Authentication
Stefan Achtsnit
 
PPTX
D@W REST security
Gaurav Sharma
 
PPTX
REST Service Authetication with TLS & JWTs
Jon Todd
 
PDF
OAuth - Open API Authentication
leahculver
 
PDF
ConFoo 2015 - Securing RESTful resources with OAuth2
Rodrigo Cândido da Silva
 
PPTX
Making Sense of API Access Control
CA API Management
 
PPTX
Api security
teodorcotruta
 
ODP
Mohanraj - Securing Your Web Api With OAuth
fossmy
 
PDF
Securty Testing For RESTful Applications
Source Conference
 
PPTX
OAuth2 + API Security
Amila Paranawithana
 
PDF
Stateless authentication for microservices - GR8Conf 2015
Alvaro Sanchez-Mariscal
 
PPTX
Enterprise Access Control Patterns for REST and Web APIs Gluecon 2011, Franco...
CA API Management
 
PPTX
JWTs for CSRF and Microservices
Stormpath
 
PPTX
Oauth2 and OWSM OAuth2 support
Gaurav Sharma
 
PPTX
Browser Security 101
Stormpath
 
Securing Web Applications with Token Authentication
Stormpath
 
Best Practices in Building an API Security Ecosystem
Prabath Siriwardena
 
JavaOne 2014 - Securing RESTful Resources with OAuth2
Rodrigo Cândido da Silva
 
Secure Your REST API (The Right Way)
Stormpath
 
Protecting Your APIs Against Attack & Hijack
CA API Management
 
Securing Single Page Applications with Token Based Authentication
Stefan Achtsnit
 
D@W REST security
Gaurav Sharma
 
REST Service Authetication with TLS & JWTs
Jon Todd
 
OAuth - Open API Authentication
leahculver
 
ConFoo 2015 - Securing RESTful resources with OAuth2
Rodrigo Cândido da Silva
 
Making Sense of API Access Control
CA API Management
 
Api security
teodorcotruta
 
Mohanraj - Securing Your Web Api With OAuth
fossmy
 
Securty Testing For RESTful Applications
Source Conference
 
OAuth2 + API Security
Amila Paranawithana
 
Stateless authentication for microservices - GR8Conf 2015
Alvaro Sanchez-Mariscal
 
Enterprise Access Control Patterns for REST and Web APIs Gluecon 2011, Franco...
CA API Management
 
JWTs for CSRF and Microservices
Stormpath
 
Oauth2 and OWSM OAuth2 support
Gaurav Sharma
 
Browser Security 101
Stormpath
 

Similar to The Ultimate Guide to Mobile API Security (20)

PDF
Build a REST API for your Mobile Apps using Node.js
Stormpath
 
PDF
Json web token api authorization
Giulio De Donato
 
PPTX
HTTP Services & REST API Security
Taiseer Joudeh
 
PPTX
JWT Authentication with AngularJS
robertjd
 
PDF
Con Foo 2017 - Don't Loose Sleep - Secure Your REST
Adam Englander
 
PDF
Secure JAX-RS
Rudy De Busscher
 
PDF
Architectural Patterns in IoT Cloud Platforms
Roshan Kulkarni
 
PPTX
How to Use Stormpath in angular js
Stormpath
 
PPTX
Hacking mobile apps
kunwaratul hax0r
 
PDF
DEF CON 24 - workshop - Craig Young - brainwashing embedded systems
Felipe Prado
 
PDF
JDD2015: Security in the era of modern applications and services - Bolesław D...
PROIDEA
 
PDF
proxy2: HTTPS pins and needles
inaz2
 
PPTX
Spa Secure Coding Guide
Geoffrey Vandiest
 
PDF
[4developers2016] - Security in the era of modern applications and services (...
PROIDEA
 
PDF
OWASP Top 10 Web Vulnerabilities from DCC 04/14
Chris Holwerda
 
PPTX
Building Secure User Interfaces With JWTs
robertjd
 
PDF
Don't Loose Sleep - Secure Your Rest - php[tek] 2017
Adam Englander
 
PDF
SSL Everywhere!
Simon Haslam
 
PPTX
PortalGuard Product Tour
PortalGuard
 
PDF
HTTP - The Other Face Of Domino
Gabriella Davis
 
Build a REST API for your Mobile Apps using Node.js
Stormpath
 
Json web token api authorization
Giulio De Donato
 
HTTP Services & REST API Security
Taiseer Joudeh
 
JWT Authentication with AngularJS
robertjd
 
Con Foo 2017 - Don't Loose Sleep - Secure Your REST
Adam Englander
 
Secure JAX-RS
Rudy De Busscher
 
Architectural Patterns in IoT Cloud Platforms
Roshan Kulkarni
 
How to Use Stormpath in angular js
Stormpath
 
Hacking mobile apps
kunwaratul hax0r
 
DEF CON 24 - workshop - Craig Young - brainwashing embedded systems
Felipe Prado
 
JDD2015: Security in the era of modern applications and services - Bolesław D...
PROIDEA
 
proxy2: HTTPS pins and needles
inaz2
 
Spa Secure Coding Guide
Geoffrey Vandiest
 
[4developers2016] - Security in the era of modern applications and services (...
PROIDEA
 
OWASP Top 10 Web Vulnerabilities from DCC 04/14
Chris Holwerda
 
Building Secure User Interfaces With JWTs
robertjd
 
Don't Loose Sleep - Secure Your Rest - php[tek] 2017
Adam Englander
 
SSL Everywhere!
Simon Haslam
 
PortalGuard Product Tour
PortalGuard
 
HTTP - The Other Face Of Domino
Gabriella Davis
 
Ad

More from Stormpath (20)

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

Recently uploaded (20)

PDF
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PDF
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
PDF
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
Bridging CAD, IBM TRIRIGA & GIS with FME: The Portland Public Schools Case
Safe Software
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
Understanding AI Optimization AIO, LLMO, and GEO
CoDigital
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Bridging CAD, IBM TRIRIGA & GIS with FME: The Portland Public Schools Case
Safe Software
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 

The Ultimate Guide to Mobile API Security

  • 1. ULTIMATE GUIDE TO MOBILE SECURITY Edward Jiang
  • 3. DEVELOPER TOOLS FOR AUTHENTICATION • Stormpath — Authentication as a Service • Web Framework Integrations — Authentication in your web framework of choice • Apache Shiro — Java security framework • JWTK — JWT libraries for JavaScript & Java • Simplicity — Easy social login for iOS • Turnstile — Authentication framework for server-side Swift
  • 5. A U T H E N T I C AT I O N H O W D O E S I T W O R K ?
  • 6. A U T H E N T I C AT I O N I T ’ S A B O U T P R O V I N G T H AT Y O U A R E W H O Y O U S AY Y O U A R E
  • 7. BASIC AUTHENTICATION GET / HTTP/1.1 Authorization: Basic Base64(username:password) • Easy and convenient, but insecure • Username / password needs to be stored on the device • Username / password are sent on every request
  • 8. TOKENIZATION “myusername” and “mypassword” becomes “rCsspweTxMtz2sypA0PLGns6fkCA” • No risk of losing the username/password from the device • Device credentials can be independently revoked from the username/password
  • 9. COOKIE AUTHENTICATION GET / HTTP/1.1 Cookie: sessionId=rCsspweTxMtz2sypA0PLGns6fkCA • Convenient: the server sets a cookie, and the HTTP Client automatically takes care of authentication • Server-side logic for authentication can be shared between mobile and web • Downside: hard to understand state
  • 10. BEARER AUTHENTICATION GET / HTTP/1.1 Authorization: Bearer rCsspweTxMtz2sypA0PLGns6fkCA • Slightly more complicated: Need to write an endpoint, and a format for the client to understand • Need to deal with storing the token (use the iOS Keychain or Android SharedPreferences) • But ultimate control over token usage, and state. Preferred method
  • 11. STATELESS TOKENS • Used at scale in larger APIs • Self contained, unlike “dumb” / opaque tokens • Can be validated easily without a round trip to a central database • Harder to use properly
  • 12. JSON WEB TOKEN eyJrafea.eyJzdWIiopkIefwEWFd.dPPxume Header Body Signature { "sub": "1234567890", "name": "John Doe", "iat": 1487260586, "exp": 1487264186 } { "typ": "JWT", "alg": "HS256" }
  • 13. STORMPATH MOBILE SDKS • Uses the Stormpath API to authenticate users & validate their identity • Authenticate to your APIs with Bearer Authentication • Use JWTs for scalability
  • 15. FINISHED RESULT • GitHub: https://github.com/stormpath/stormpath-ios-example • Review this tutorial: https://stormpath.com/blog/build-note-taking-app-swift-ios
  • 16. WHAT NEXT? • Try the Android counterpart: https://stormpath.com/blog/build-user-authentication-for- android-app • Learn how to build a REST API for mobile: https://stormpath.com/blog/tutorial-build-rest- api-mobile-apps-using-node-js • Talk to us! Email [email protected], or [email protected] • Follow us @EdwardStarcraft and @goStormpath on Twitter