score:20
after some thinking, i came up with the following solution which worked quite nicely for me.
saml has something called relaystate
which is a property that the service provider has to respond with. so now the process looks like this:
- user accesses
http://frontendserver.com
and gets server the static page with the react application (not signed in.). - user clicks 'login' and gets redirected to
http://backendserver.com/login/?relaystate=http://frontendserver.com
which authenticates via passport-saml and redirects user to sp. so i pass the origin of the request in relaystate. - user calls back to http://backendserver.com/callback with the samlresponse, which includes the relaystate.
- i create a token, and redirect the user to
relaystate/#token
. - i can then parse the url in the react application, and add the token as a header for any further requests.
this might've seemed like the obvious way to do it, but it took me quite a while to figure out that this would work.
score:0
i know this question is for node backend, but i found an article of the implementation for a php/apache webserver backend here and i think it can help someone trying to understand the flow of the process of how this type of thing works.
Source: stackoverflow.com
Related Query
- SAML2.0 Authentication with Node.js and SPA
- Single page application with HttpOnly cookie-based authentication and session management
- Using react-router and express with authentication via Passport.js - possible?
- Authentication with oidc-client.js and Identityserver4 in a React frontend
- How to correctly redirect after catching authentication failure with Apollo and React
- Problem with protected routes, context API and firebase user authentication request
- Implementing authentication and authorization with React hooks, .NET Core Web API, and SQL Server
- User authentication with ASP MVC and React
- Nuclide debugger with node and babel?
- How to add login authentication and session to ReactJS React Router and Redux with MongoDB + NodeJS Express?
- How to perform authentication with React hooks and react-router
- how to build a standalone desktop app built with react, using a node backend, and wrap both frontend and backend in electron as a desktop app?
- node express Server does not serve compressed static files with brotli and gzip compression
- How do I render a pug/jade template with React, Node and Webpack?
- Identify roles with SPA and .NET Core 3
- Active Directory Authentication with .NET Core Web API and React
- Next Js combined with an external REST API Authentication and atuhorization
- how to run my node application and react app in the same time with one command?
- How to run node server.js and npm start with one command
- how to I get a user's IP address when separate client and server apps, in Node with Nest.js
- How to use token-based authentication with axios and react
- Authentication in .net Core with ReactJS SPA
- How can I Fetch and display Mysql data into ReactJS front end with Node JS as backend?
- How to handle authentication from a Node Express redirect to React Client (react-router-dom and useContext)
- .Net Core 2.1 with IdentityServer4 Cookie and API JWT based authentication for the same app
- ReactJs FE and Django Rest Services with Azure AD for authentication & Authorization
- I developed website for movies and pushed it to Heroku successfully(done with node js and React) but it's not running
- Login authentication with axios and formik
- How to Integrate Rails User Authentication and Authorization with a Front End App?
- How to contact twitter api with client authentication using express as proxy and xhr as client
More Query from same tag
- Enzyme render styled component with theme
- React Redux skeleton returning undefined for value from state
- Adding to component from another component using React
- Express post request gives ERR_EMPTY_RESPONSE
- Is there a way to separately style components rendered using the .map() function?
- How to move react event handlers to separate file ,export and then import for reuse in multiple different functional components?
- Using react i18next on all nested components
- How to transition from one page to another in react app
- Pivot/Transform Javascript array of objects
- How can I clear a setTimeout which is created on a component life cycle?
- React Router 4 with Typescript, Redirect
- How to use material-ui-pickers KeyboardDatePicker with moment?
- How to override Chrome new tab content with a react component
- How to style Flowbite React Components
- react evironment variables .env return undefined
- Design pattern for implementing hooks in form
- How to test a click event with enzyme in a React component's dangerouslySetInnerHTML content
- React: how can I call a function when a component has loaded?
- Why is gatsby-plugin-image missing image prop?
- react-mapbox-gl accessing lat and lon on click
- Portion render when this.state update?
- Only update one item from ReactJS state items
- Trying to upload an image using Firebase storage and Firestore Database - encountering a map error
- How to toggle multiple class in ReactJS
- ReferenceError: window is not defined in React
- How to use if statement in export default function in react.js?
- How to access data from array using javascript
- value is not getting stored in "state" by " this.setState({ value})"
- Next JS Image Component works for static image files, but dynamic urls fail to load images
- Conditionally assign ref in react