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

PPTX
Single-Page-Application & REST security
PPTX
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...
PPTX
REST API Security: OAuth 2.0, JWTs, and More!
PPTX
Rest API Security
PDF
Authentication: Cookies vs JWTs and why you’re doing it wrong
PPTX
Token Authentication for Java Applications
PPTX
Secure API Services in Node with Basic Auth and OAuth2
PPTX
Securing RESTful APIs using OAuth 2 and OpenID Connect
Single-Page-Application & REST security
API Security & Federation Patterns - Francois Lascelles, Chief Architect, Lay...
REST API Security: OAuth 2.0, JWTs, and More!
Rest API Security
Authentication: Cookies vs JWTs and why you’re doing it wrong
Token Authentication for Java Applications
Secure API Services in Node with Basic Auth and OAuth2
Securing RESTful APIs using OAuth 2 and OpenID Connect

What's hot (20)

PDF
Securing Web Applications with Token Authentication
PPTX
Best Practices in Building an API Security Ecosystem
PDF
JavaOne 2014 - Securing RESTful Resources with OAuth2
PPTX
Secure Your REST API (The Right Way)
PDF
Protecting Your APIs Against Attack & Hijack
PPTX
Securing Single Page Applications with Token Based Authentication
PPTX
D@W REST security
PPTX
REST Service Authetication with TLS & JWTs
PDF
OAuth - Open API Authentication
PDF
ConFoo 2015 - Securing RESTful resources with OAuth2
PPTX
Making Sense of API Access Control
PPTX
Api security
ODP
Mohanraj - Securing Your Web Api With OAuth
PDF
Securty Testing For RESTful Applications
PPTX
OAuth2 + API Security
PDF
Stateless authentication for microservices - GR8Conf 2015
PPTX
Enterprise Access Control Patterns for REST and Web APIs Gluecon 2011, Franco...
PPTX
JWTs for CSRF and Microservices
PPTX
Oauth2 and OWSM OAuth2 support
PPTX
Browser Security 101
Securing Web Applications with Token Authentication
Best Practices in Building an API Security Ecosystem
JavaOne 2014 - Securing RESTful Resources with OAuth2
Secure Your REST API (The Right Way)
Protecting Your APIs Against Attack & Hijack
Securing Single Page Applications with Token Based Authentication
D@W REST security
REST Service Authetication with TLS & JWTs
OAuth - Open API Authentication
ConFoo 2015 - Securing RESTful resources with OAuth2
Making Sense of API Access Control
Api security
Mohanraj - Securing Your Web Api With OAuth
Securty Testing For RESTful Applications
OAuth2 + API Security
Stateless authentication for microservices - GR8Conf 2015
Enterprise Access Control Patterns for REST and Web APIs Gluecon 2011, Franco...
JWTs for CSRF and Microservices
Oauth2 and OWSM OAuth2 support
Browser Security 101
Ad

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

PDF
Build a REST API for your Mobile Apps using Node.js
PDF
Mobile Authentication for iOS Applications - Stormpath 101
PPTX
Mobile Authentication for iOS Applications
PPT
Securing RESTful API
PPTX
Building Secure User Interfaces With JWTs (JSON Web Tokens)
PPTX
WebHack #13 Web authentication essentials
PDF
Mobile Authentication - Onboarding, best practices & anti-patterns
PDF
WebAuthn & FIDO2
PPTX
Secureyourrestapi 140530183606-phpapp02
PDF
When and Why Would I use Oauth2?
PDF
Centralise legacy auth at the ingress gateway, SREday
PDF
Centralise legacy auth at the ingress gateway
PDF
JDD2015: Security in the era of modern applications and services - Bolesław D...
PDF
OAuth Base Camp
PPTX
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
PDF
Plan B: Service to Service Authentication with OAuth
PPTX
OAuth - Don’t Throw the Baby Out with the Bathwater
PDF
slides-101-edu-sesse-introduction-to-oauth-20-01.pdf
PDF
Centralise legacy auth at the ingress gateway
PPTX
Devteach 2017 OAuth and Open id connect demystified
Build a REST API for your Mobile Apps using Node.js
Mobile Authentication for iOS Applications - Stormpath 101
Mobile Authentication for iOS Applications
Securing RESTful API
Building Secure User Interfaces With JWTs (JSON Web Tokens)
WebHack #13 Web authentication essentials
Mobile Authentication - Onboarding, best practices & anti-patterns
WebAuthn & FIDO2
Secureyourrestapi 140530183606-phpapp02
When and Why Would I use Oauth2?
Centralise legacy auth at the ingress gateway, SREday
Centralise legacy auth at the ingress gateway
JDD2015: Security in the era of modern applications and services - Bolesław D...
OAuth Base Camp
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
Plan B: Service to Service Authentication with OAuth
OAuth - Don’t Throw the Baby Out with the Bathwater
slides-101-edu-sesse-introduction-to-oauth-20-01.pdf
Centralise legacy auth at the ingress gateway
Devteach 2017 OAuth and Open id connect demystified
Ad

More from Stormpath (19)

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

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Encapsulation theory and applications.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Cloud computing and distributed systems.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
KodekX | Application Modernization Development
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Modernizing your data center with Dell and AMD
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
A Presentation on Artificial Intelligence
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
NewMind AI Monthly Chronicles - July 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
The Rise and Fall of 3GPP – Time for a Sabbatical?
Encapsulation theory and applications.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Cloud computing and distributed systems.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KodekX | Application Modernization Development
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Modernizing your data center with Dell and AMD
MYSQL Presentation for SQL database connectivity
Digital-Transformation-Roadmap-for-Companies.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Review of recent advances in non-invasive hemoglobin estimation
CIFDAQ's Market Insight: SEC Turns Pro Crypto

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 support@stormpath.com, or edward@stormpath.com • Follow us @EdwardStarcraft and @goStormpath on Twitter