• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

Initial page load remove the landing page and just load the login form

Scheduled Pinned Locked Moved
Comments & Feedback
3
4
18.3k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    jacksontrevan
    last edited by 7 Jun 2023, 16:23

    I need help, I am just trying to load the FusionAuth login screen without showing the landing page with the login button first. I am not sure how to automate the event that redirects and loads the FusionAuth login page in my react application.

    1 Reply Last reply Reply Quote 0
    • J
      jamesseoexpert12
      last edited by 14 Jun 2023, 14:00

      To achieve this, you'll need to use a routing mechanism in your React application to handle the navigation flow. One popular library for managing routes in React is React Router. Here's a step-by-step guide on how you can automate the redirect to the FusionAuth login page:

      Install React Router in your project by running the following command in your terminal:
      Copy code
      npm install react-router-dom
      In your React application, create a new file (let's call it AppRouter.js) where you'll define your routes. Import the necessary components from React Router:
      jsx
      Copy code
      import { BrowserRouter as Router, Route, Redirect } from 'react-router-dom';
      import { FusionAuthLogin } from './FusionAuthLogin'; // Replace with the actual component for FusionAuth login
      Set up your routes within the Router component. Define a route that matches the landing page and redirects to the FusionAuth login page:
      jsx
      Copy code
      const AppRouter = () => {
      return (
      <Router>
      <Route exact path="/">
      <Redirect to="/login" />
      </Route>
      <Route path="/login" component={FusionAuthLogin} />
      {/* Add more routes for other pages in your application */}
      </Router>
      );
      };

      export default AppRouter;

      1 Reply Last reply Reply Quote 0
      • J
        jacksontrevan
        last edited by 21 Jun 2023, 15:40

        Your approach is assuming I built my own login component. I want to use the login UI generated by FusionAuth, when the user clicks on the login button that is a component inside the fusionauth react-sdk. I want to completely remove this initial workflow, so when the user launches the application the root route with redirect the user to /oauth2/authorize endpoint.

        M 1 Reply Last reply 26 Jun 2023, 21:12 Reply Quote 0
        • M
          mark.robustelli @jacksontrevan
          last edited by 26 Jun 2023, 21:12

          @jacksontrevan - Let me start of by saying I am not very familiar with React applications. However, thinking about typical application flow, What would happen if the user was already logged in? Can't you get the login screen by just directing them to a secured page vs a "landing page"?

          1 Reply Last reply Reply Quote 0
          • First post
            Last post