SlideShare a Scribd company logo
"Auth for React.js APP", Nikita Galkin
Nikita
Galkin
Love and Know:
▰ How to make developers and business happy
▰ Technical and process debt elimination
Believe that:
▰ Any problem must be solved at the right level
▰ Software is easy. People are hard
▰ A problem should be highlighted, an idea should
be "sold", a solution should be demonstrated
Links:
Site GitHub Twitter Facebook
2
Main idea
Stop writing code,
use existing
solutions for solving
business needs
What is
Auth?
"Auth for React.js APP", Nikita Galkin
What’s authentication and authorization?
Authentication — a process of
verifying the identity.
Air Force Photo/Paul Zadach
What’s authentication and authorization?
Authentication — a process of
verifying the identity.
Air Force Photo/Paul Zadach
401
relogin
What’s authentication and authorization?
Authentication — a process of
verifying the identity.
Air Force Photo/Paul Zadach
401
relogin
What’s authentication and authorization?
Authorization — a process of defining
access policy for some resource.
What’s authentication and authorization?
Authorization — a process of defining
access policy for some resource.
403
relogin
Don't write
yours custom
Auth
1. Registration flow
2. Password reset flow
3. Credentials Validation
4. Error Handling
5. Error Messages
Before user can authenticate
you need to implement:
6. Localization
7. Brute-force attacks
protection
8. Email templates
1. “Remember me”
feature
2. Deleting or
blocking/suspending
users
After user authenticates,
you need to think about
3. Event log
4. Anomaly Detection
5. MFA
6. Global logout
7. Scaling
Use Auth as
Service
Popular Authentication Services
1. Registration flow
2. Password reset flow
3. Credentials Validation
4. Error Handling
5. Error Messages
6. Localization
7. Brute-force attacks
protection
8. Email templates
"Auth for React.js APP", Nikita Galkin
"Auth for React.js APP", Nikita Galkin
"Auth for React.js APP", Nikita Galkin
"Auth for React.js APP", Nikita Galkin
Amazon Cognito Example
"Auth for React.js APP", Nikita Galkin
● Firebase – free (without Phone Auth)
● Cognito – free 50,000 MAU,
$0.0055 per user after
● Auth0 – free Up to 7,000 MAU,
$23/mo Up to 50,000 MAU,
x.000$/mo after
● Okta – 🔥💵
Pricing
Ownership cost =
Development cost +
Maintenance cost +
Risks control cost
Auth Flow
"Auth for React.js APP", Nikita Galkin
"Auth for React.js APP", Nikita Galkin
"Auth for React.js APP", Nikita Galkin
JWT
"Auth for React.js APP", Nikita Galkin
useAuth
AuthProvider
● @auth0/auth0-react – 237,957
● @okta/okta-react – 63,787
● @aws-amplify/ui-react – 42,794
● react-firebaseui – 17,733
● reactfire – 3,833
Package’s Weekly Downloads:
1. HOC
2. Hooks
▻ useState
▻ useEffect
▻ useMemo
3. Context Provider
▻ useAuth = useContext
Possible Implementations:
import { useState, useEffect, useMemo } from 'react'
import Auth from '@aws-amplify/auth'
export default ({ provider, options }) => {
const [state, setState] = useState({
user: {},
isSignedIn: false
})
const auth = useMemo(() => {
Auth.configure(options)
return Auth
}, [])
useEffect(() => {
auth.currentAuthenticatedUser()
.then((user) => setState({ user, isSignedIn: true }))
.catch(() => {})
}, [])
const signIn = () => auth.federatedSignIn({ provider })
const signOut = () => auth.signOut()
return {
...state,
signIn,
signOut
}
}
import { useState, useEffect, useMemo } from 'react'
import Auth from '@aws-amplify/auth'
export default ({ provider, options }) => {
const [state, setState] = useState({
user: {},
isSignedIn: false
})
const auth = useMemo(() => {
Auth.configure(options)
return Auth
}, [])
useEffect(() => {
auth.currentAuthenticatedUser()
.then((user) => setState({ user, isSignedIn: true }))
.catch(() => {})
}, [])
const signIn = () => auth.federatedSignIn({ provider })
const signOut = () => auth.signOut()
return {
...state,
signIn,
signOut
}
}
import { useState, useEffect, useMemo } from 'react'
import Auth from '@aws-amplify/auth'
export default ({ provider, options }) => {
const [state, setState] = useState({
user: {},
isSignedIn: false
})
const auth = useMemo(() => {
Auth.configure(options)
return Auth
}, [])
useEffect(() => {
auth.currentAuthenticatedUser()
.then((user) => setState({ user, isSignedIn: true }))
.catch(() => {})
}, [])
const signIn = () => auth.federatedSignIn({ provider })
const signOut = () => auth.signOut()
return {
...state,
signIn,
signOut
}
}
import { useState, useEffect, useMemo } from 'react'
import Auth from '@aws-amplify/auth'
export default ({ provider, options }) => {
const [state, setState] = useState({
user: {},
isSignedIn: false
})
const auth = useMemo(() => {
Auth.configure(options)
return Auth
}, [])
useEffect(() => {
auth.currentAuthenticatedUser()
.then((user) => setState({ user, isSignedIn: true }))
.catch(() => {})
}, [])
const signIn = () => auth.federatedSignIn({ provider })
const signOut = () => auth.signOut()
return {
...state,
signIn,
signOut
}
}
import { useState, useEffect, useMemo } from 'react'
import Auth from '@aws-amplify/auth'
export default ({ provider, options }) => {
const [state, setState] = useState({
user: {},
isSignedIn: false
})
const auth = useMemo(() => {
Auth.configure(options)
return Auth
}, [])
useEffect(() => {
auth.currentAuthenticatedUser()
.then((user) => setState({ user, isSignedIn: true }))
.catch(() => {})
}, [])
const signIn = () => auth.federatedSignIn({ provider })
const signOut = () => auth.signOut()
return {
...state,
signIn,
signOut
}
}
Configuration
"Auth for React.js APP", Nikita Galkin
resource "google_identity_platform_inbound_saml_config" "saml_config" {
name = "saml.tf-config"
display_name = "Display Name"
idp_config {
idp_entity_id = "tf-idp"
sign_request = true
sso_url = "https://example.com"
idp_certificates {
x509_certificate = file("test-fixtures/rsa_cert.pem")
}
}
sp_config {
sp_entity_id = "tf-sp"
callback_uri = "https://example.com"
}
}
Main idea
Stop writing code,
use existing
solutions for solving
business needs
Questions
time!

More Related Content

PDF
FwDays 2021: Metarhia Technology Stack for Node.js
PDF
"The little big project. From zero to hero in two weeks with 3 front-end engi...
PDF
Nko workshop - node js crud & deploy
PPTX
Building Your First Data Science Applicatino in MongoDB
PPTX
ES6, 잘 쓰고 계시죠?
PPTX
Cnam azure 2014 mobile services
PDF
Websockets talk at Rubyconf Uruguay 2010
PPTX
Architecting Secure and Compliant Applications with MongoDB
FwDays 2021: Metarhia Technology Stack for Node.js
"The little big project. From zero to hero in two weeks with 3 front-end engi...
Nko workshop - node js crud & deploy
Building Your First Data Science Applicatino in MongoDB
ES6, 잘 쓰고 계시죠?
Cnam azure 2014 mobile services
Websockets talk at Rubyconf Uruguay 2010
Architecting Secure and Compliant Applications with MongoDB

What's hot (20)

PDF
Micro app-framework
PDF
Arduino、Web 到 IoT
PDF
MongoDB Performance Debugging
PDF
Mongodb debugging-performance-problems
PPTX
How Not to Code
PDF
Bonnes pratiques de développement avec Node js
PPTX
ES6 is Nigh
PPTX
Mongoose and MongoDB 101
PDF
JavaScript and the AST
PDF
Security 202 - Are you sure your site is secure?
PDF
FalsyValues. Dmitry Soshnikov - ECMAScript 6
ODP
My app is secure... I think
PDF
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
PDF
DEF CON 23 - amit ashbel and maty siman - game of hacks
PDF
Mastering Spring Boot's Actuator with Madhura Bhave
PDF
リローダブルClojureアプリケーション
PDF
ES2015 workflows
PPTX
Correcting Common Async/Await Mistakes in .NET
PDF
ChromeからMacBookのTouchIDでWebAuthenticationする ~Idance vol1~
 
PDF
Mongo db for c# developers
Micro app-framework
Arduino、Web 到 IoT
MongoDB Performance Debugging
Mongodb debugging-performance-problems
How Not to Code
Bonnes pratiques de développement avec Node js
ES6 is Nigh
Mongoose and MongoDB 101
JavaScript and the AST
Security 202 - Are you sure your site is secure?
FalsyValues. Dmitry Soshnikov - ECMAScript 6
My app is secure... I think
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
DEF CON 23 - amit ashbel and maty siman - game of hacks
Mastering Spring Boot's Actuator with Madhura Bhave
リローダブルClojureアプリケーション
ES2015 workflows
Correcting Common Async/Await Mistakes in .NET
ChromeからMacBookのTouchIDでWebAuthenticationする ~Idance vol1~
 
Mongo db for c# developers
Ad

Similar to "Auth for React.js APP", Nikita Galkin (20)

PDF
GDG Cloud Taipei: Meetup #52 - Istio Security: API Authorization
PDF
OAuth 2.0 – A standard is coming of age by Uwe Friedrichsen
PDF
OAuth 2.0
PDF
Cross-Platform Authentication with Google+ Sign-In
PPTX
Code your Own: Authentication Provider for Blackboard Learn
PPTX
2012 SVCodeCamp: In App Payments with HTML5
PDF
Getting Started with FIDO2
PDF
Passwords suck, but centralized proprietary services are not the answer
PPTX
SSO with Social Login Integration & FastAPI Simplified
PDF
Digging Deeper into Desktop and Mobile App Security
PPTX
HTML5 Gaming Payment Platforms
PDF
How Netflix Is Solving Authorization Across Their Cloud
PPTX
Integrating OAuth and Social Login Into Wordpress
PPTX
Social Gold in-Flash Webinar Jan 2010
PPTX
Social Gold In-Flash Payments Webinar
KEY
Authentication
PPTX
Altitude San Francisco 2018: Authentication at the Edge
PDF
Integrating services with OAuth
PDF
Client-side Auth with Ember.js
PDF
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
GDG Cloud Taipei: Meetup #52 - Istio Security: API Authorization
OAuth 2.0 – A standard is coming of age by Uwe Friedrichsen
OAuth 2.0
Cross-Platform Authentication with Google+ Sign-In
Code your Own: Authentication Provider for Blackboard Learn
2012 SVCodeCamp: In App Payments with HTML5
Getting Started with FIDO2
Passwords suck, but centralized proprietary services are not the answer
SSO with Social Login Integration & FastAPI Simplified
Digging Deeper into Desktop and Mobile App Security
HTML5 Gaming Payment Platforms
How Netflix Is Solving Authorization Across Their Cloud
Integrating OAuth and Social Login Into Wordpress
Social Gold in-Flash Webinar Jan 2010
Social Gold In-Flash Payments Webinar
Authentication
Altitude San Francisco 2018: Authentication at the Edge
Integrating services with OAuth
Client-side Auth with Ember.js
How React Native, Appium and me made each other shine @ContinuousDeliveryAmst...
Ad

More from Fwdays (20)

PDF
"Mastering UI Complexity: State Machines and Reactive Patterns at Grammarly",...
PDF
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
PPTX
"Computer Use Agents: From SFT to Classic RL", Maksym Shamrai
PPTX
"Як ми переписали Сільпо на Angular", Євген Русаков
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
PDF
"Validation and Observability of AI Agents", Oleksandr Denisyuk
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
PPTX
"Co-Authoring with a Machine: What I Learned from Writing a Book on Generativ...
PPTX
"Human-AI Collaboration Models for Better Decisions, Faster Workflows, and Cr...
PDF
"AI is already here. What will happen to your team (and your role) tomorrow?"...
PPTX
"Is it worth investing in AI in 2025?", Alexander Sharko
PDF
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
PDF
"Scaling in space and time with Temporal", Andriy Lupa.pdf
PDF
"Database isolation: how we deal with hundreds of direct connections to the d...
PDF
"Scaling in space and time with Temporal", Andriy Lupa .pdf
PPTX
"Provisioning via DOT-Chain: from catering to drone marketplaces", Volodymyr ...
PPTX
" Observability with Elasticsearch: Best Practices for High-Load Platform", A...
PPTX
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
PPTX
"Istio Ambient Mesh in production: our way from Sidecar to Sidecar-less",Hlib...
"Mastering UI Complexity: State Machines and Reactive Patterns at Grammarly",...
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
"Computer Use Agents: From SFT to Classic RL", Maksym Shamrai
"Як ми переписали Сільпо на Angular", Євген Русаков
"AI Transformation: Directions and Challenges", Pavlo Shaternik
"Validation and Observability of AI Agents", Oleksandr Denisyuk
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
"Co-Authoring with a Machine: What I Learned from Writing a Book on Generativ...
"Human-AI Collaboration Models for Better Decisions, Faster Workflows, and Cr...
"AI is already here. What will happen to your team (and your role) tomorrow?"...
"Is it worth investing in AI in 2025?", Alexander Sharko
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Database isolation: how we deal with hundreds of direct connections to the d...
"Scaling in space and time with Temporal", Andriy Lupa .pdf
"Provisioning via DOT-Chain: from catering to drone marketplaces", Volodymyr ...
" Observability with Elasticsearch: Best Practices for High-Load Platform", A...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"Istio Ambient Mesh in production: our way from Sidecar to Sidecar-less",Hlib...

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Cloud computing and distributed systems.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation theory and applications.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
cuic standard and advanced reporting.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Network Security Unit 5.pdf for BCA BBA.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Weekly Chronicles - August'25 Week I
Cloud computing and distributed systems.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation_ Review paper, used for researhc scholars
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation theory and applications.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Programs and apps: productivity, graphics, security and other tools
Understanding_Digital_Forensics_Presentation.pptx
sap open course for s4hana steps from ECC to s4
cuic standard and advanced reporting.pdf
MYSQL Presentation for SQL database connectivity
Digital-Transformation-Roadmap-for-Companies.pptx
MIND Revenue Release Quarter 2 2025 Press Release

"Auth for React.js APP", Nikita Galkin

  • 2. Nikita Galkin Love and Know: ▰ How to make developers and business happy ▰ Technical and process debt elimination Believe that: ▰ Any problem must be solved at the right level ▰ Software is easy. People are hard ▰ A problem should be highlighted, an idea should be "sold", a solution should be demonstrated Links: Site GitHub Twitter Facebook 2
  • 4. Stop writing code, use existing solutions for solving business needs
  • 7. What’s authentication and authorization? Authentication — a process of verifying the identity. Air Force Photo/Paul Zadach
  • 8. What’s authentication and authorization? Authentication — a process of verifying the identity. Air Force Photo/Paul Zadach 401 relogin
  • 9. What’s authentication and authorization? Authentication — a process of verifying the identity. Air Force Photo/Paul Zadach 401 relogin
  • 10. What’s authentication and authorization? Authorization — a process of defining access policy for some resource.
  • 11. What’s authentication and authorization? Authorization — a process of defining access policy for some resource. 403 relogin
  • 13. 1. Registration flow 2. Password reset flow 3. Credentials Validation 4. Error Handling 5. Error Messages Before user can authenticate you need to implement: 6. Localization 7. Brute-force attacks protection 8. Email templates
  • 14. 1. “Remember me” feature 2. Deleting or blocking/suspending users After user authenticates, you need to think about 3. Event log 4. Anomaly Detection 5. MFA 6. Global logout 7. Scaling
  • 17. 1. Registration flow 2. Password reset flow 3. Credentials Validation 4. Error Handling 5. Error Messages 6. Localization 7. Brute-force attacks protection 8. Email templates
  • 24. ● Firebase – free (without Phone Auth) ● Cognito – free 50,000 MAU, $0.0055 per user after ● Auth0 – free Up to 7,000 MAU, $23/mo Up to 50,000 MAU, x.000$/mo after ● Okta – 🔥💵 Pricing
  • 25. Ownership cost = Development cost + Maintenance cost + Risks control cost
  • 30. JWT
  • 33. ● @auth0/auth0-react – 237,957 ● @okta/okta-react – 63,787 ● @aws-amplify/ui-react – 42,794 ● react-firebaseui – 17,733 ● reactfire – 3,833 Package’s Weekly Downloads:
  • 34. 1. HOC 2. Hooks ▻ useState ▻ useEffect ▻ useMemo 3. Context Provider ▻ useAuth = useContext Possible Implementations:
  • 35. import { useState, useEffect, useMemo } from 'react' import Auth from '@aws-amplify/auth' export default ({ provider, options }) => { const [state, setState] = useState({ user: {}, isSignedIn: false }) const auth = useMemo(() => { Auth.configure(options) return Auth }, []) useEffect(() => { auth.currentAuthenticatedUser() .then((user) => setState({ user, isSignedIn: true })) .catch(() => {}) }, []) const signIn = () => auth.federatedSignIn({ provider }) const signOut = () => auth.signOut() return { ...state, signIn, signOut } }
  • 36. import { useState, useEffect, useMemo } from 'react' import Auth from '@aws-amplify/auth' export default ({ provider, options }) => { const [state, setState] = useState({ user: {}, isSignedIn: false }) const auth = useMemo(() => { Auth.configure(options) return Auth }, []) useEffect(() => { auth.currentAuthenticatedUser() .then((user) => setState({ user, isSignedIn: true })) .catch(() => {}) }, []) const signIn = () => auth.federatedSignIn({ provider }) const signOut = () => auth.signOut() return { ...state, signIn, signOut } }
  • 37. import { useState, useEffect, useMemo } from 'react' import Auth from '@aws-amplify/auth' export default ({ provider, options }) => { const [state, setState] = useState({ user: {}, isSignedIn: false }) const auth = useMemo(() => { Auth.configure(options) return Auth }, []) useEffect(() => { auth.currentAuthenticatedUser() .then((user) => setState({ user, isSignedIn: true })) .catch(() => {}) }, []) const signIn = () => auth.federatedSignIn({ provider }) const signOut = () => auth.signOut() return { ...state, signIn, signOut } }
  • 38. import { useState, useEffect, useMemo } from 'react' import Auth from '@aws-amplify/auth' export default ({ provider, options }) => { const [state, setState] = useState({ user: {}, isSignedIn: false }) const auth = useMemo(() => { Auth.configure(options) return Auth }, []) useEffect(() => { auth.currentAuthenticatedUser() .then((user) => setState({ user, isSignedIn: true })) .catch(() => {}) }, []) const signIn = () => auth.federatedSignIn({ provider }) const signOut = () => auth.signOut() return { ...state, signIn, signOut } }
  • 39. import { useState, useEffect, useMemo } from 'react' import Auth from '@aws-amplify/auth' export default ({ provider, options }) => { const [state, setState] = useState({ user: {}, isSignedIn: false }) const auth = useMemo(() => { Auth.configure(options) return Auth }, []) useEffect(() => { auth.currentAuthenticatedUser() .then((user) => setState({ user, isSignedIn: true })) .catch(() => {}) }, []) const signIn = () => auth.federatedSignIn({ provider }) const signOut = () => auth.signOut() return { ...state, signIn, signOut } }
  • 42. resource "google_identity_platform_inbound_saml_config" "saml_config" { name = "saml.tf-config" display_name = "Display Name" idp_config { idp_entity_id = "tf-idp" sign_request = true sso_url = "https://example.com" idp_certificates { x509_certificate = file("test-fixtures/rsa_cert.pem") } } sp_config { sp_entity_id = "tf-sp" callback_uri = "https://example.com" } }
  • 44. Stop writing code, use existing solutions for solving business needs