{"id":20307297,"url":"https://github.com/oktadev/okta-react-graphql-example","last_synced_at":"2025-10-28T03:04:03.160Z","repository":{"id":103824367,"uuid":"136092641","full_name":"oktadev/okta-react-graphql-example","owner":"oktadev","description":"Health Tracking App with React, GraphQL, and TypeORM","archived":false,"fork":false,"pushed_at":"2019-11-09T12:41:54.000Z","size":1365,"stargazers_count":43,"open_issues_count":6,"forks_count":18,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-11T15:14:19.561Z","etag":null,"topics":["apollo-client","graphql","javascript","react","typeorm","typescript"],"latest_commit_sha":null,"homepage":"https://developer.okta.com/blog/2018/07/11/build-react-graphql-api-user-authentication","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oktadev.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-04T23:11:57.000Z","updated_at":"2024-06-01T10:21:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"2290b69a-ebb1-4f5b-a0af-c245286e6903","html_url":"https://github.com/oktadev/okta-react-graphql-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oktadev/okta-react-graphql-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-react-graphql-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-react-graphql-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-react-graphql-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-react-graphql-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oktadev","download_url":"https://codeload.github.com/oktadev/okta-react-graphql-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oktadev%2Fokta-react-graphql-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260713324,"owners_count":23050824,"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":["apollo-client","graphql","javascript","react","typeorm","typescript"],"created_at":"2024-11-14T17:17:08.160Z","updated_at":"2025-10-28T03:04:03.155Z","avatar_url":"https://github.com/oktadev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Health Tracking App with React, GraphQL, and TypeORM\n\nThis example app shows how to use React, GraphQL, and TypeORM to build a health tracking app and add authentication with Okta.\n\nPlease read [Build a Health Tracking App with React and GraphQL, and TypeORM](https://developer.okta.com/blog/2018/07/11/build-react-graphql-api-user-authentication) to see how this app was created.\n\n**Prerequisites:** [Node.js](https://nodejs.org/).\n\n\u003e [Okta](https://developer.okta.com/) has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage, and secure users and roles in any application.\n\n* [Getting Started](#getting-started)\n* [Links](#links)\n* [Help](#help)\n* [License](#license)\n\n## Getting Started\n\nTo install this example application, run the following commands:\n\n```bash\ngit clone https://github.com/oktadeveloper/okta-react-graphql-example.git\ncd okta-react-graphql-example\n```\n\nThis will get a copy of the project installed locally. To install all of its dependencies and start each app, follow the instructions below.\n\nTo run the GraphQL API, cd into the `graphql-api` folder and install its dependencies:\n \n```bash\nnpm i\n```\n\nThis project is configured to use a MySQL database. You can change its settings by modifying [`graphql-api/ormconfig.json`](graphql-api/ormconfig.json). To create a MySQL database with the default settings, run the following commands:\n\n```bash\nmysql -u root -p\ncreate database healthpoints;\nuse healthpoints;\ngrant all privileges on *.* to 'health'@'localhost' identified by 'points';\n```\n\nAfter this database exists, start the API with `npm start`.\n\nTo run the client, cd into the `react-client` folder and run:\n \n```bash\nnpm i\nnpm start\n```\n\n### Setup Okta\n\nLog in to your Okta Developer account (or [sign up](https://developer.okta.com/signup/) if you don’t have an account) and navigate to **Applications** \u003e **Add Application**. Click **Single-Page App**, click **Next**, and give the app a name you’ll remember. Click **Done**.\n\n#### Server Configuration\n\nOpen `graphql-api/index.ts` and replace `{yourOktadomain}` and `{yourClientId}` in the following code block. \n\n```ts\nconst oktaJwtVerifier = new OktaJwtVerifier({\n  clientId: '{yourClientId}',\n  issuer: 'https://{yourOktaDomain}/oauth2/default'\n});\n```\n\n**NOTE:** The value of `{yourOktaDomain}` should be something like `dev-123456.oktapreview`. Make sure you don't include `-admin` or two `.com` in the value!\n\n#### Client Configuration\n\nFor the client, set the `issuer` and `client_id` in `react-client/src/App.js`.\n\n```js\nclass App extends Component {\n  render() {\n    return (\n      \u003cRouter\u003e\n        \u003cSecurity issuer='https://{yourOktaDomain}.com/oauth2/default'\n                  client_id='{yourClientId}'\n                  redirect_uri={window.location.origin + '/implicit/callback'}\n                  onAuthRequired={onAuthRequired}\u003e\n          \u003cRoute path='/' exact={true} component={Home}/\u003e\n          \u003cSecureRoute path='/points' component={Points}/\u003e\n          \u003cRoute path='/login' render={() =\u003e \u003cLogin baseUrl='https://dev-669532.oktapreview.com'/\u003e}/\u003e\n          \u003cRoute path='/implicit/callback' component={ImplicitCallback}/\u003e\n        \u003c/Security\u003e\n      \u003c/Router\u003e\n    );\n  }\n}\n```\n\n## Links\n\nThis example uses the following libraries provided by Okta:\n\n* [Okta JWT Verifier](https://github.com/okta/okta-oidc-js/tree/master/packages/jwt-verifier)\n* [Okta Sign-In Widget](https://github.com/okta/okta-signin-widget)\n\n## Help\n\nPlease post any questions as comments on the [blog post](https://developer.okta.com/blog/2018/07/11/build-react-graphql-api-user-authentication), or visit our [Okta Developer Forums](https://devforum.okta.com/). You can also email developers@okta.com if you would like to create a support ticket.\n\n## License\n\nApache 2.0, see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-react-graphql-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foktadev%2Fokta-react-graphql-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foktadev%2Fokta-react-graphql-example/lists"}