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.1k
    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

      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

        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

          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.

          mark.robustelliM 1 Reply Last reply Reply Quote 0
          • mark.robustelliM
            mark.robustelli @jacksontrevan
            last edited by

            @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