# Login Widget with React JS ## Requirements 1. Node 18+ 2. NPM 8+ ## Configure Your ForgeRock Server 1. [Ensure CORS is enabled](https://backstage.forgerock.com/docs/idcloud/latest/tenants/configure-cors.html) 2. [Create an OAuth client](https://backstage.forgerock.com/docs/idcloud-am/latest/oauth2-guide/oauth2-configure-authz.html) (Native/SPA client) with the following values: - Client ID: `WebLoginWidgetClient` - Scopes: `openid email` - Sign in URLs: `http://localhost:5173/` (port number may vary) - Enable Implied Consent - Ensure Token Endpoint Authentication Method is set to 'none' - Grant Types contains `Authorization Code` 3. Ensure you have the default "Login" journey/tree ## Create a Vite App 1. Create Vite app with `npm create vite` ([more info can be found on Vite's docs](https://vitejs.dev/guide/#scaffolding-your-first-vite-project)) 2. Follow prompts, choosing React as your desired library 3. Open the newly created directory in your IDE of choice 4. With your terminal/bash, install the dependencies: `npm install` (or, simply `npm i`) 5. Run the app in developer mode: `npm run dev` 6. Copy the URL printed in the console to see the rendered app (usually `http://localhost:5173`) Pro tip: using a different browser for development testing than the one you use to log into the ForgeRock platform. This is a good idea as admin user and test user sessions can collide causing odd authentication failures. ## Install the Login Widget Install the Login Widget via your open terminal: `npm install @forgerock/login-widget@beta`. The Widget is currently in beta and requires the use of the `beta` tag. ## Prepare the HTML & CSS Return back to the project in your IDE and look for the `index.html` file. Since we will start with the Modal type component of the Widget, create a root element on which the Widget will mount by adding `
` towards the bottom of the `` element, but before the `