{"id":20828398,"url":"https://github.com/codewithmuh/react-auth0","last_synced_at":"2026-04-19T23:33:32.752Z","repository":{"id":112273246,"uuid":"521905416","full_name":"codewithmuh/React-Auth0","owner":"codewithmuh","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-06T09:51:48.000Z","size":346,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-27T09:25:13.993Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codewithmuh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-08-06T09:42:30.000Z","updated_at":"2023-04-11T16:01:37.000Z","dependencies_parsed_at":"2023-05-22T10:15:48.882Z","dependency_job_id":null,"html_url":"https://github.com/codewithmuh/React-Auth0","commit_stats":null,"previous_names":["codewithmuh/react-auth0"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codewithmuh/React-Auth0","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmuh%2FReact-Auth0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmuh%2FReact-Auth0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmuh%2FReact-Auth0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmuh%2FReact-Auth0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithmuh","download_url":"https://codeload.github.com/codewithmuh/React-Auth0/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithmuh%2FReact-Auth0/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32026620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-11-17T23:14:45.541Z","updated_at":"2026-04-19T23:33:32.731Z","avatar_url":"https://github.com/codewithmuh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easy User Authentication for React Apps\n\nThis repository hosts a React project that defines a Single-Page Application (SPA). You'll secure access to some of its routes using Auth0 User Authentication.\n\n## Get Started\n\nInstall the client project dependencies:\n\n```bash\nnpm install\n```\n\n## Set Up Authentication with Auth0\n\nIf you haven't already, \u003ca href=\"https://auth0.com/signup\" data-amp-replace=\"CLIENT_ID\" data-amp-addparams=\"anonId=CLIENT_ID(cid-scope-cookie-fallback-name)\"\u003e**sign up for a free Auth0 account**\u003c/a\u003e.\n\nOnce you sign in, Auth0 takes you to the [Dashboard](https://manage.auth0.com/). In the left sidebar menu, click on [\"Applications\"](https://manage.auth0.com/#/applications).\n\nThen, click the \"Create Application\" button. A modal opens up with a form to provide a name for the application and choose its type.\n\n- **Name:** Auth0 React Sample\n\n- **Application Type:** Single Page Web Applications\n\nClick the \"Create\" button to complete the process. Your Auth0 application page loads up.\n\nYour React application will redirect users to Auth0 whenever they trigger an authentication request. Auth0 will present them with a login page. Once they log in, Auth0 will redirect them back to your React application. For that redirecting to happen securely, you must specify in your **Auth0 Application Settings** the URLs to which Auth0 can redirect users once it authenticates them.\n\nAs such, click on the \"Settings\" tab of your Auth0 Application page and fill in the following values:\n\n\n**Allowed Callback URLs**\n\n```bash\nhttp://localhost:4040\n```\n\n**Allowed Logout URLs**\n\n```bash\nhttp://localhost:4040\n```\n\n**Allowed Web Origins**\n\n```bash\nhttp://localhost:4040\n```\n\n**Scroll down and click the \"Save Changes\" button.**\n\nOpen the React starter project, `auth0-react-sample`, and create a `.env` file under the project directory:\n\n```bash\ntouch .env\n```\n\nPopulate `.env` as follows:\n\n```bash\nREACT_APP_AUTH0_DOMAIN=\nREACT_APP_AUTH0_CLIENT_ID=\nREACT_APP_AUTH0_AUDIENCE=https://express.sample\nREACT_APP_SERVER_URL=http://localhost:6060\n```\n\nThe value of `REACT_APP_AUTH0_DOMAIN` is the \"Domain\" value from the \"Settings\".\n\nThe value of `REACT_APP_AUTH0_CLIENT_ID` is the \"Client ID\" value from the \"Settings\".\n\n## Run the Project\n\nRun the client project:\n\n```bash\nnpm start\n```\n\nThe application runs by on port `4040` to mitigate conflicting with other client applications you may be running.\n\nVisit [`http://localhost:4040/`](http://localhost:4040/) to access the starter application.\n\n## Set up the Demo API\n\nYou can set up this Express demo server to test making secure API calls from your React application.\n\n### Get the Express API demo\n\nClone the `auth0-express-js-sample` repo:\n\n```bash\ngit clone git@github.com:auth0-blog/auth0-express-js-sample.git\n```\n\nMake the `auth0-express-js-sample` directory your current directory:\n\n```bash\ncd auth0-express-js-sample\n```\n\nInstall the Node.js project dependencies:\n\n```bash\nnpm install\n```\n\n### Connect the Express API with Auth0\n\nHead to the [APIs section in the Auth0 Dashboard](https://manage.auth0.com/#/apis), and click the \"Create API\" button.\n\nThen, in the form that Auth0 shows:\n \n- Add a **Name** to your API:\n\n```bash\nAuth0 Express Sample\n```\n\n- Set its **Identifier** value:\n\n```bash\nhttps://express.sample\n```\n\n- Leave the signing algorithm as `RS256` as it's the best option from a security standpoint.\n\nWith these values in place, hit the \"Create\" button.\n\nKeep this page open as you'll be using the values next.\n\nCreate a `.env` file for the API Server under the `auth0-express-js-sample` directory:\n\n```bash\ntouch .env\n```\n\nPopulate this `auth0-express-js-sample/.env` file as follows:\n\n```bash\nSERVER_PORT=6060\nCLIENT_ORIGIN_URL=http://localhost:4040\nAUTH0_AUDIENCE=\nAUTH0_DOMAIN=\n```\n\nHead back to your Auth0 API page, and **follow these steps to get the Auth0 Audience**:\n\n![Get the Auth0 Audience to configure an API](https://cdn.auth0.com/blog/complete-guide-to-user-authentication/get-the-auth0-audience.png)\n\n1. Click on the **\"Settings\"** tab.\n\n2. Locate the **\"Identifier\"** field and copy its value.\n\n3. Paste the \"Identifier\" value as the value of `AUTH0_AUDIENCE` in `.env`.\n\nNow, **follow these steps to get the Auth0 Domain value**:\n\n1. Click on the **\"Test\"** tab.\n2. Locate the section called **\"Asking Auth0 for tokens from my application\"**.\n3. Click on the **cURL** tab to show a mock `POST` request.\n4. Copy your Auth0 domain, which is _part_ of the `--url` parameter value: `tenant-name.region.auth0.com`.\n5. Paste the Auth0 domain value as the value of `AUTH0_DOMAIN` in `.env`.\n\n\u003e **Tips to get the Auth0 Domain**\n\u003e - The Auth0 Domain is the substring between the protocol, `https://` and the path `/oauth/token`.\n\u003e - The Auth0 Domain follows this pattern: `tenant-name.region.auth0.com`.\n\u003e - The `region` subdomain (`au`, `us`, or `eu`) is optional. Some Auth0 Domains don't have it.\n\nWith the `.env` configuration values set, run the API server by issuing the following command:\n\n```bash\nnpm start\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithmuh%2Freact-auth0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithmuh%2Freact-auth0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithmuh%2Freact-auth0/lists"}