{"id":21096800,"url":"https://github.com/stytchauth/stytch-react-example","last_synced_at":"2025-08-18T23:04:21.983Z","repository":{"id":38456837,"uuid":"327130978","full_name":"stytchauth/stytch-react-example","owner":"stytchauth","description":"Example B2C React application featuring Email Magic Link and Google OAuth authentication powered by Stytch","archived":false,"fork":false,"pushed_at":"2025-07-10T16:50:51.000Z","size":2344,"stargazers_count":49,"open_issues_count":11,"forks_count":18,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-10T19:38:29.198Z","etag":null,"topics":["react","stytch"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/stytchauth.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-05T22:04:37.000Z","updated_at":"2025-07-11T01:42:38.000Z","dependencies_parsed_at":"2024-03-19T23:28:42.812Z","dependency_job_id":"50b4503c-6a68-4eb4-9eda-3d5428d68ccd","html_url":"https://github.com/stytchauth/stytch-react-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stytchauth/stytch-react-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stytchauth%2Fstytch-react-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stytchauth%2Fstytch-react-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stytchauth%2Fstytch-react-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stytchauth%2Fstytch-react-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stytchauth","download_url":"https://codeload.github.com/stytchauth/stytch-react-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stytchauth%2Fstytch-react-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271073387,"owners_count":24694538,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"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":["react","stytch"],"created_at":"2024-11-19T22:43:58.764Z","updated_at":"2025-08-18T23:04:21.973Z","avatar_url":"https://github.com/stytchauth.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stytch B2C React example application\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/100632220/217049841-b9eeb72a-3e50-4074-839a-e64ee5d4a88c.png\" width=\"750\"\u003e\n\u003c/p\u003e\n\n## Overview\n\nThis example application demonstrates how one may use Stytch within a React application. The project now uses [Vite](https://vitejs.dev/) for development and building the application.\n\nThis project uses Stytch's [React SDK](https://stytch.com/docs/sdks/javascript-sdk) which provides pre-built UI components, useful React hooks, and headless methods to securely interact with Stytch.\n\nThis application features Email Magic Links and OAuth. You can use this application's source code as a learning resource, or use it as a jumping off point for your own project. We are excited to see what you build with Stytch!\n\nThis app also implements an authorization page for Stytch Connected Apps, which hosts the IdentityProvider component (related guide in Stytch docs is [here](https://stytch.com/docs/guides/connected-apps/cli-app)). If you're just here to learn about Stytch with React, ignore `components/Authorize.js`.\n\n## New! Set up with a Coding Agent\n\nInstall the [Stytch MCP Server](https://mcp.stytch.dev) and instruct coding agents to follow the steps in `Agents.md`. \n\n## Set up\n\nFollow the steps below to get this application fully functional and running using your own Stytch credentials.\n\n### In the Stytch Dashboard\n\n1. Create a [Stytch](https://stytch.com/) account. Once your account is set up a Project called \"My first project\" will be automatically created for you.\n\n2. Within your new Project, navigate to [SDK configuration](https://stytch.com/dashboard/sdk-configuration), and make the following changes:\n\n   - Click **Enable SDK**.\n   - Under **Authorized environments** add the domain `http://localhost:3000`.\n\n     \u003cimg width=\"400\" alt=\"Authorized environments\" src=\"https://user-images.githubusercontent.com/100632220/217052985-2e6fc264-7b8b-452b-9d24-66a76c143d10.png\"\u003e\n\n3. Navigate to [Redirect URLs](https://stytch.com/dashboard/redirect-urls), and add `http://localhost:3000/authenticate` as the types **Login** and **Sign-up**.\n\n   \u003cimg width=\"400\" alt=\"Redirect URLs\" src=\"https://user-images.githubusercontent.com/100632220/217054016-913cabda-098e-4436-9829-2f33e7db05a7.png\"\u003e\n\n4. Finally, navigate to [API Keys](https://stytch.com/dashboard/api-keys), and copy your `public_token`. You will need this value later on.\n\n### On your machine\n\nIn your terminal clone the project and install dependencies:\n\n```bash\ngit clone https://github.com/stytchauth/stytch-react-example.git\ncd stytch-react-example\nnpm i\n```\n\nNext, create a `.env.local` file by running the command below, and enter your `public_token`, and optionally project ID, secret, and Connected Apps client ID.\n\nThe Stytch public token should be stored in an environment variable named `VITE_STYTCH_PUBLIC_TOKEN`.\n\n```bash\ncp .env.template .env.local\n```\n\n## Running locally\n\nAfter completing all the set up steps above the application can be run with the command:\n\n```bash\nnpm start\n```\n\nThe application will be available at [`http://localhost:3000`](http://localhost:3000) using Vite's development server.\n\nYou'll be able to login with Email Magic Links and see your Stytch User object, Stytch Session, and see how logging out works.\n\nTo run the app with an API backend available at port 3001 for use with the [Connected Apps CLI example](https://github.com/stytchauth/stytch-connected-apps-cli-example), run the following command:\n\n```bash\nnpm run server\n```\n\n## Next steps\n\nThis example app showcases a small portion of what you can accomplish with Stytch. Here are a few ideas to explore:\n\n1. Add additional login methods like [Passwords](https://stytch.com/docs/guides/passwords/sdk).\n2. Replace the prebuilt UI with your own using by using the SDK's [headless methods](https://stytch.com/docs/guides/implementation/frontend-headless).\n3. Add a Google OAuth button, or replace it with the high converting [Google One Tap UI](https://stytch.com/docs/guides/oauth/sdk#add-google-one-tap-via-the-sdk).\n4. Secure your app further by building MFA authentication using methods like [Passkeys](https://stytch.com/docs/guides/passkeys/overview).\n5. Use [Stytch Sessions](https://stytch.com/docs/guides/sessions/using-sessions) to secure your backend.\n\n## Get help and join the community\n\n#### :speech_balloon: Stytch community Slack\n\nJoin the discussion, ask questions, and suggest new features in our [Slack community](https://stytch.com/docs/resources/support/overview)!\n\n#### :question: Need support?\n\nCheck out the [Stytch Forum](https://forum.stytch.com/) or email us at [support@stytch.com](mailto:support@stytch.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstytchauth%2Fstytch-react-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstytchauth%2Fstytch-react-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstytchauth%2Fstytch-react-example/lists"}