SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
Securing Single-Page
Applications with OAuth 2.0
Prabath Siriwardena, WSO2
Twitter: @prabath | Email: prabath@wso2.com
● Director of Security Architecture at WSO2.
● Apache Committer.
● Blog: http://blog.facilelogin.com | http://blog.api-security.org
● Authored four books: http://www.amazon.com/author/prabath
● Web Application
● User Agent-based Application
● Native Application
● Single-Page Applications (SPAs) are Web apps that load a single HTML
page and dynamically update that page as the user interacts with the
app.
● An SPA is an application delivered to the browser that doesn’t reload
the page during use.
● SPAs use AJAX and HTML5 to create fluid and responsive Web apps,
without constant page reloads.
● The “page” in SPA is the single web page that the server sends to the
browser when the application starts. It’s the server rendered HTML
that gets everything started. No more, no less. After that initial page
load, all of the presentation logic is on the client.
● Much of the work happens on the client side, in JavaScript.
● User Agent-based Application
TRADITIONAL PAGE LIFECYCLE
SPA LIFECYCLE
Password Grant Type
● Two fundamental issues you find in any ‘pure’ SPA application.
○ An SPA accessing an OAuth secured API is - the client cannot be
authenticated in a completely legitimate manner.
○ An SPA accessing an OAuth secured API is - the access token
cannot be made invisible to the end-user.
● No single sign on experience.
● Users have to provide their credentials directly to the SPA - rather
than to the identity provider. Must trust the SPA.
● No UI redirections.
Password Grant Type
Implicit Grant Type
Implicit Grant Type
● Two fundamental issues you find in any ‘pure’ SPA application.
○ An SPA accessing an OAuth secured API is - the client cannot be
authenticated in a completely legitimate manner.
○ An SPA accessing an OAuth secured API is - the access token
cannot be made invisible to the end-user.
● Single Sign On experience.
● Users do not need to provide credentials to the SPA, rather to the
identity provider.
● UI redirections.
Implicit Grant Type
● An SPA accessing an OAuth secured API is - the client cannot be
authenticated in a completely legitimate manner.
○ Impact
■ Invoke APIs protected with client_credentials grant type.
■ Impersonate a legitimate client application and fool the user
to get his consent to access user resources on behalf of the
legitimate user.
○ Recommendations
■ Reject any tokens used to access APIs, which are issued under
client_credentials grant type.
■ The authorization should do proper validations on the
redirect_url.
● An SPA accessing an OAuth secured API is - the access token cannot
be made invisible to the end-user.
○ Impact
■ Can eat-out throttling limits associated with an API per
application.
■ Access token returned backed from the implicit grant type is
in browser history. Can be used by illegitimate users.
○ Recommendations
■ Enforce per user per application throttling limits.
■ Make the access tokens short-lived.
■ One time access token - discard the access token in its first
use (access token chaining).
OAuth Proxy
● Two fundamental issues you find in any ‘pure’ SPA application.
○ An SPA accessing an OAuth secured API is - the client cannot be
authenticated in a completely legitimate manner.
○ An SPA accessing an OAuth secured API is - the access token
cannot be made invisible to the end-user.
● Single Sign On experience.
● Users do not need to provide credentials to the SPA, rather to the
identity provider.
● UI redirections.
● Not pure SPA - all the API calls from the SPA should go through the
SPA.
OAuth Proxy
● Create a JWE with the access token, user info - encrypt and set it in
a session cookie, in the response to the login
● All the API calls from the SPA to the proxy, this cookie will be
included.
Stateless OAuth Proxy
var xmlHttp = new XMLHttpRequest();
xmlHttp.withCredentials = true;
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
var obj = JSON.parse(xmlHttp.responseText);
document.getElementById('name-id').innerHTML = obj.sub;
}
};
xmlHttp.open("GET",
"https://localhost:9443/oauth2-proxy/users?code="
+ sessionStorage.getItem("guid"), true);
xmlHttp.send();
Stateless OAuth Proxy
Securing Single-Page Applications with OAuth 2.0

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

An Introduction to OAuth 2
An Introduction to OAuth 2An Introduction to OAuth 2
An Introduction to OAuth 2
 
An introduction to OAuth 2
An introduction to OAuth 2An introduction to OAuth 2
An introduction to OAuth 2
 
OpenStack Keystone
OpenStack KeystoneOpenStack Keystone
OpenStack Keystone
 
Introduction to OAuth2.0
Introduction to OAuth2.0Introduction to OAuth2.0
Introduction to OAuth2.0
 
An Introduction to OAuth2
An Introduction to OAuth2An Introduction to OAuth2
An Introduction to OAuth2
 
Demystifying OAuth 2.0
Demystifying OAuth 2.0Demystifying OAuth 2.0
Demystifying OAuth 2.0
 
Microservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring CloudMicroservice With Spring Boot and Spring Cloud
Microservice With Spring Boot and Spring Cloud
 
OpenID Connect vs. OpenID 1 & 2
OpenID Connect vs. OpenID 1 & 2OpenID Connect vs. OpenID 1 & 2
OpenID Connect vs. OpenID 1 & 2
 
OAuth2 + API Security
OAuth2 + API SecurityOAuth2 + API Security
OAuth2 + API Security
 
Implementing OAuth
Implementing OAuthImplementing OAuth
Implementing OAuth
 
Hashicorp Vault: Open Source Secrets Management at #OPEN18
Hashicorp Vault: Open Source Secrets Management at #OPEN18Hashicorp Vault: Open Source Secrets Management at #OPEN18
Hashicorp Vault: Open Source Secrets Management at #OPEN18
 
DCSF19 Container Security: Theory & Practice at Netflix
DCSF19 Container Security: Theory & Practice at NetflixDCSF19 Container Security: Theory & Practice at Netflix
DCSF19 Container Security: Theory & Practice at Netflix
 
CA API Gateway: Web API and Application Security
CA API Gateway: Web API and Application SecurityCA API Gateway: Web API and Application Security
CA API Gateway: Web API and Application Security
 
THE STATE OF OPENTELEMETRY, DOTAN HOROVITS, Logz.io
THE STATE OF OPENTELEMETRY, DOTAN HOROVITS, Logz.ioTHE STATE OF OPENTELEMETRY, DOTAN HOROVITS, Logz.io
THE STATE OF OPENTELEMETRY, DOTAN HOROVITS, Logz.io
 
Secret Management with Hashicorp’s Vault
Secret Management with Hashicorp’s VaultSecret Management with Hashicorp’s Vault
Secret Management with Hashicorp’s Vault
 
Operator Framework Overview
Operator Framework OverviewOperator Framework Overview
Operator Framework Overview
 
Continuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket PipelinesContinuous Delivery in the Cloud with Bitbucket Pipelines
Continuous Delivery in the Cloud with Bitbucket Pipelines
 
OpenID Connect: An Overview
OpenID Connect: An OverviewOpenID Connect: An Overview
OpenID Connect: An Overview
 
Learn More About Object Store | MuleSoft Mysore Meetup #9
Learn More About Object Store | MuleSoft Mysore Meetup #9Learn More About Object Store | MuleSoft Mysore Meetup #9
Learn More About Object Store | MuleSoft Mysore Meetup #9
 
Deep-Dive: Secure API Management
Deep-Dive: Secure API ManagementDeep-Dive: Secure API Management
Deep-Dive: Secure API Management
 

Similar a Securing Single-Page Applications with OAuth 2.0

Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Stateless authentication with OAuth 2 and JWT - JavaZone 2015Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Alvaro Sanchez-Mariscal
 

Similar a Securing Single-Page Applications with OAuth 2.0 (20)

OAuth 2.0 for Web and Native (Mobile) App Developers
OAuth 2.0 for Web and Native (Mobile) App DevelopersOAuth 2.0 for Web and Native (Mobile) App Developers
OAuth 2.0 for Web and Native (Mobile) App Developers
 
API Security Best Practices & Guidelines
API Security Best Practices & GuidelinesAPI Security Best Practices & Guidelines
API Security Best Practices & Guidelines
 
API Security Best Practices & Guidelines
API Security Best Practices & GuidelinesAPI Security Best Practices & Guidelines
API Security Best Practices & Guidelines
 
apidays LIVE Australia 2021 - Leveraging Async APIs to deliver Cross Domain A...
apidays LIVE Australia 2021 - Leveraging Async APIs to deliver Cross Domain A...apidays LIVE Australia 2021 - Leveraging Async APIs to deliver Cross Domain A...
apidays LIVE Australia 2021 - Leveraging Async APIs to deliver Cross Domain A...
 
Y U No OAuth?!?
Y U No OAuth?!?Y U No OAuth?!?
Y U No OAuth?!?
 
Security for oauth 2.0 - @topavankumarj
Security for oauth 2.0 - @topavankumarjSecurity for oauth 2.0 - @topavankumarj
Security for oauth 2.0 - @topavankumarj
 
Setting the Foundation for Digital Transformation Through API Management and ...
Setting the Foundation for Digital Transformation Through API Management and ...Setting the Foundation for Digital Transformation Through API Management and ...
Setting the Foundation for Digital Transformation Through API Management and ...
 
Role of API Management in an API led Digital Economy
Role of API Management in an API led Digital EconomyRole of API Management in an API led Digital Economy
Role of API Management in an API led Digital Economy
 
RESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTRESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoT
 
Y U No OAuth, Using Common Patterns to Secure Your Web Applications
Y U No OAuth, Using Common Patterns to Secure Your Web ApplicationsY U No OAuth, Using Common Patterns to Secure Your Web Applications
Y U No OAuth, Using Common Patterns to Secure Your Web Applications
 
How to build Simple yet powerful API.pptx
How to build Simple yet powerful API.pptxHow to build Simple yet powerful API.pptx
How to build Simple yet powerful API.pptx
 
API Security In Cloud Native Era
API Security In Cloud Native EraAPI Security In Cloud Native Era
API Security In Cloud Native Era
 
WSO2 App Manager: Managing Application Lifecycles Across Your Enterprise
WSO2 App Manager: Managing Application Lifecycles Across Your EnterpriseWSO2 App Manager: Managing Application Lifecycles Across Your Enterprise
WSO2 App Manager: Managing Application Lifecycles Across Your Enterprise
 
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
 
The curious case of mobile app security.pptx
The curious case of mobile app security.pptxThe curious case of mobile app security.pptx
The curious case of mobile app security.pptx
 
Api management best practices with wso2 api manager
Api management best practices with wso2 api managerApi management best practices with wso2 api manager
Api management best practices with wso2 api manager
 
APIs: The Gateway to Digital Transformation
APIs: The Gateway to Digital TransformationAPIs: The Gateway to Digital Transformation
APIs: The Gateway to Digital Transformation
 
Smartphone Native Application OP
Smartphone Native Application OPSmartphone Native Application OP
Smartphone Native Application OP
 
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Stateless authentication with OAuth 2 and JWT - JavaZone 2015Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
 
OpenID Connect
OpenID ConnectOpenID Connect
OpenID Connect
 

Más de Prabath Siriwardena

Más de Prabath Siriwardena (20)

Microservices Security Landscape
Microservices Security LandscapeMicroservices Security Landscape
Microservices Security Landscape
 
Cloud Native Identity with SPIFFE
Cloud Native Identity with SPIFFECloud Native Identity with SPIFFE
Cloud Native Identity with SPIFFE
 
Identity is Eating the World!
Identity is Eating the World!Identity is Eating the World!
Identity is Eating the World!
 
Microservices Security Landscape
Microservices Security LandscapeMicroservices Security Landscape
Microservices Security Landscape
 
OAuth 2.0 Threat Landscape
OAuth 2.0 Threat LandscapeOAuth 2.0 Threat Landscape
OAuth 2.0 Threat Landscape
 
GDPR for Identity Architects
GDPR for Identity ArchitectsGDPR for Identity Architects
GDPR for Identity Architects
 
Blockchain-based Solutions for Identity & Access Management
Blockchain-based Solutions for Identity & Access ManagementBlockchain-based Solutions for Identity & Access Management
Blockchain-based Solutions for Identity & Access Management
 
OAuth 2.0 Threat Landscapes
OAuth 2.0 Threat LandscapesOAuth 2.0 Threat Landscapes
OAuth 2.0 Threat Landscapes
 
Identity Management for Web Application Developers
Identity Management for Web Application DevelopersIdentity Management for Web Application Developers
Identity Management for Web Application Developers
 
Open Standards in Identity Management
Open Standards  in  Identity ManagementOpen Standards  in  Identity Management
Open Standards in Identity Management
 
Best Practices in Building an API Security Ecosystem
Best Practices in Building an API Security EcosystemBest Practices in Building an API Security Ecosystem
Best Practices in Building an API Security Ecosystem
 
Connected Identity : The Role of the Identity Bus
Connected Identity : The Role of the Identity BusConnected Identity : The Role of the Identity Bus
Connected Identity : The Role of the Identity Bus
 
Connected Identity : Benefits, Risks & Challenges
Connected Identity : Benefits, Risks & ChallengesConnected Identity : Benefits, Risks & Challenges
Connected Identity : Benefits, Risks & Challenges
 
The Evolution of Internet Identity
The Evolution of Internet IdentityThe Evolution of Internet Identity
The Evolution of Internet Identity
 
Next-Gen Apps with IoT and Cloud
Next-Gen Apps with IoT and CloudNext-Gen Apps with IoT and Cloud
Next-Gen Apps with IoT and Cloud
 
Securing Insecure
Securing InsecureSecuring Insecure
Securing Insecure
 
Evolution of Internet Identity
Evolution of Internet IdentityEvolution of Internet Identity
Evolution of Internet Identity
 
Securing the Insecure
Securing the InsecureSecuring the Insecure
Securing the Insecure
 
WSO2Con USA 2014 - Identity Server Tutorial
WSO2Con USA 2014 - Identity Server TutorialWSO2Con USA 2014 - Identity Server Tutorial
WSO2Con USA 2014 - Identity Server Tutorial
 
Advanced API Security
Advanced API SecurityAdvanced API Security
Advanced API Security
 

Último

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Último (20)

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 

Securing Single-Page Applications with OAuth 2.0

  • 1. Securing Single-Page Applications with OAuth 2.0 Prabath Siriwardena, WSO2 Twitter: @prabath | Email: prabath@wso2.com
  • 2. ● Director of Security Architecture at WSO2. ● Apache Committer. ● Blog: http://blog.facilelogin.com | http://blog.api-security.org ● Authored four books: http://www.amazon.com/author/prabath
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. ● Web Application ● User Agent-based Application ● Native Application
  • 10. ● Single-Page Applications (SPAs) are Web apps that load a single HTML page and dynamically update that page as the user interacts with the app. ● An SPA is an application delivered to the browser that doesn’t reload the page during use. ● SPAs use AJAX and HTML5 to create fluid and responsive Web apps, without constant page reloads. ● The “page” in SPA is the single web page that the server sends to the browser when the application starts. It’s the server rendered HTML that gets everything started. No more, no less. After that initial page load, all of the presentation logic is on the client. ● Much of the work happens on the client side, in JavaScript. ● User Agent-based Application
  • 14. ● Two fundamental issues you find in any ‘pure’ SPA application. ○ An SPA accessing an OAuth secured API is - the client cannot be authenticated in a completely legitimate manner. ○ An SPA accessing an OAuth secured API is - the access token cannot be made invisible to the end-user. ● No single sign on experience. ● Users have to provide their credentials directly to the SPA - rather than to the identity provider. Must trust the SPA. ● No UI redirections. Password Grant Type
  • 17. ● Two fundamental issues you find in any ‘pure’ SPA application. ○ An SPA accessing an OAuth secured API is - the client cannot be authenticated in a completely legitimate manner. ○ An SPA accessing an OAuth secured API is - the access token cannot be made invisible to the end-user. ● Single Sign On experience. ● Users do not need to provide credentials to the SPA, rather to the identity provider. ● UI redirections. Implicit Grant Type
  • 18. ● An SPA accessing an OAuth secured API is - the client cannot be authenticated in a completely legitimate manner. ○ Impact ■ Invoke APIs protected with client_credentials grant type. ■ Impersonate a legitimate client application and fool the user to get his consent to access user resources on behalf of the legitimate user. ○ Recommendations ■ Reject any tokens used to access APIs, which are issued under client_credentials grant type. ■ The authorization should do proper validations on the redirect_url.
  • 19. ● An SPA accessing an OAuth secured API is - the access token cannot be made invisible to the end-user. ○ Impact ■ Can eat-out throttling limits associated with an API per application. ■ Access token returned backed from the implicit grant type is in browser history. Can be used by illegitimate users. ○ Recommendations ■ Enforce per user per application throttling limits. ■ Make the access tokens short-lived. ■ One time access token - discard the access token in its first use (access token chaining).
  • 21. ● Two fundamental issues you find in any ‘pure’ SPA application. ○ An SPA accessing an OAuth secured API is - the client cannot be authenticated in a completely legitimate manner. ○ An SPA accessing an OAuth secured API is - the access token cannot be made invisible to the end-user. ● Single Sign On experience. ● Users do not need to provide credentials to the SPA, rather to the identity provider. ● UI redirections. ● Not pure SPA - all the API calls from the SPA should go through the SPA. OAuth Proxy
  • 22. ● Create a JWE with the access token, user info - encrypt and set it in a session cookie, in the response to the login ● All the API calls from the SPA to the proxy, this cookie will be included. Stateless OAuth Proxy var xmlHttp = new XMLHttpRequest(); xmlHttp.withCredentials = true; xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { var obj = JSON.parse(xmlHttp.responseText); document.getElementById('name-id').innerHTML = obj.sub; } }; xmlHttp.open("GET", "https://localhost:9443/oauth2-proxy/users?code=" + sessionStorage.getItem("guid"), true); xmlHttp.send();