{"id":25012442,"url":"https://github.com/auth0-samples/auth0-acul-react-boilerplate","last_synced_at":"2025-04-12T20:52:50.063Z","repository":{"id":267233525,"uuid":"899358514","full_name":"auth0-samples/auth0-acul-react-boilerplate","owner":"auth0-samples","description":"Auth0 ACUL React Boilerplate","archived":false,"fork":false,"pushed_at":"2025-02-21T12:00:43.000Z","size":144,"stargazers_count":4,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T20:52:44.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auth0-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-06T05:25:05.000Z","updated_at":"2025-02-21T12:00:43.000Z","dependencies_parsed_at":"2024-12-15T12:15:51.031Z","dependency_job_id":null,"html_url":"https://github.com/auth0-samples/auth0-acul-react-boilerplate","commit_stats":null,"previous_names":["auth0/auth0-acul-react-boilerplate"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0-samples%2Fauth0-acul-react-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0-samples%2Fauth0-acul-react-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0-samples%2Fauth0-acul-react-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0-samples%2Fauth0-acul-react-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auth0-samples","download_url":"https://codeload.github.com/auth0-samples/auth0-acul-react-boilerplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631725,"owners_count":21136560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-05T06:11:08.167Z","updated_at":"2025-04-12T20:52:50.056Z","avatar_url":"https://github.com/auth0-samples.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Universal Login Boilerplate App\n\nThis boilerplate application helps you get started with building a customized login screen for Auth0 using React, TypeScript, and Vite. Universal Login offers a streamlined experience for users and does not require JavaScript for customization.\n\n⚠ This boilerplate app is intended to be used alongside a technical documentation guide published [here](https://auth0.com/docs/customize/login-pages/advanced-customizations/getting-started).\n\n##  Documentation\n\n- [Quickstart](https://auth0.com/docs/customize/login-pages/advanced-customizations/getting-started/sdk-quickstart) - our guide for getting started with ACUL development.\n- [ACUL JS SDK](https://github.com/auth0/universal-login/tree/master/packages/auth0-acul-js) - The Auth0 ACUL JS SDK, integrated into this boilerplate for handling authentication flows.\n\n\n\n## Getting Started\n\nFollow these steps to get the application up and running locally:\n\n### 1. Clone the Repository\n\n```sh\ngit clone https://github.com/auth0/auth0-acul-react-boilerplate.git\ncd auth0-acul-react-boilerplate\n```\n\n### 2. Install Dependencies\n\n\nInstall the dependencies:\n\n```sh\nnpm install\n```\n\n### 3. Build the Application\n\n```sh\nnpm run build\n```\n\n### 4. Serve the Application\n\nAfter building the application, serve it locally using `http-server`:\n\n```sh\ncd dist\nnpx http-server dist -p 8080\n```\n\nThis will start a local server on the specified port. Access the application by navigating to the link provided in the terminal.\n\n### 5. Test the Application with Sample Quickstart\n\nGo to your quickstart application and log in.\n\n## How the Login Works\n\n### Creating and Appending the Root Element\n\nIn the `src/main.tsx` file, create a `div` element and append it to the `body` of the document. This is necessary for the Universal Login to work correctly:\n\n```tsx\nconst rootElement = document.createElement(\"div\");\nrootElement.id = \"root\";\n\ndocument.body.appendChild(rootElement);\ndocument.body.style.overflow = \"hidden\";\n```\n\n### Initializing Screen Objects\n\nIn the `src/screens/LoginId/index.tsx` file, initialize an object for the LoginId screen to manage the state and behavior specific to this screen:\n\n```tsx\nimport { LoginId } from '@auth0/auth0-acul-js';\nimport { useState } from 'react';\n\nexport const LoginIdScreen = () =\u003e {\n  const loginManager = new LoginId();\n  const [email, setEmail] = useState('');\n\n  return (\n    \u003cdiv className=\"w-[100vw] min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8\"\u003e\n      \u003cdiv className=\"max-w-md w-full space-y-6 bg-white p-8 rounded-lg shadow-md\"\u003e\n        \u003cinput\n          type=\"email\"\n          placeholder=\"Enter your email\"\n          value={email}\n          onChange={(e) =\u003e setEmail(e.target.value)}\n          className=\"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500\"\n        /\u003e\n\n        \u003cbutton \n          className=\"w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-black bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500\"\n          onClick={() =\u003e loginManager.login({ username: email })}\n        \u003e\n          Continue\n        \u003c/button\u003e\n\n        {loginManager.transaction.alternateConnections?.map(({ name, strategy }) =\u003e (\n          \u003cbutton\n            key={name}\n            className=\"w-full flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500\"\n            onClick={() =\u003e loginManager.socialLogin({ connection: name })}\n          \u003e\n            Continue with {strategy}\n          \u003c/button\u003e\n        ))}\n      \u003c/div\u003e\n    \u003c/div\u003e\n  );\n};\n\nexport default LoginIdScreen;\n```\n\n## Additional Information\n\n- This project uses Vite for fast development and build processes.\n- ESLint is configured to enforce code quality and consistency.\n- SCSS is used for styling, focusing on modular and reusable styles.\n\nFor more details on customizing and extending this application, refer to the official documentation of the libraries and tools used:\n\n- [React](https://reactjs.org/)\n- [TypeScript](https://www.typescriptlang.org/)\n- [Vite](https://vitejs.dev/)\n- [Auth0](https://auth0.com/)\n\n### Have Fun with Your Own Coding Style!\n\nFeel free to use your own coding style to create beautiful login pages. Customize the styles, add animations, and make the user experience delightful.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0-samples%2Fauth0-acul-react-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauth0-samples%2Fauth0-acul-react-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0-samples%2Fauth0-acul-react-boilerplate/lists"}