Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oktadev/okta-node-express-typescript-react-example
Node.js API with TypeScript
https://github.com/oktadev/okta-node-express-typescript-react-example
api nodejs react typescript
Last synced: 1 day ago
JSON representation
Node.js API with TypeScript
- Host: GitHub
- URL: https://github.com/oktadev/okta-node-express-typescript-react-example
- Owner: oktadev
- License: apache-2.0
- Created: 2019-04-01T16:11:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:47:11.000Z (almost 2 years ago)
- Last Synced: 2024-04-15T15:55:23.116Z (7 months ago)
- Topics: api, nodejs, react, typescript
- Language: TypeScript
- Homepage: https://developer.okta.com/blog/2019/05/07/nodejs-typescript-api
- Size: 1.46 MB
- Stars: 14
- Watchers: 5
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Example App Using Node, TypeScript, and React
This example app shows how to create a simple real-time chat server using Node and TypeScript, as well as a frontend to interact with it using React. This uses Okta for authentication.
Please read [Build a Node.js API with TypeScript](https://developer.okta.com/blog/2019/05/07/nodejs-typescript-api) to see how this example was built.
**Prerequisites**: [Node.js](https://nodejs.org/en/).
## Getting Started
To install this example application, run the following commands:
```bash
git clone https://github.com/oktadeveloper/okta-node-express-typescript-react-example.git
cd okta-node-express-typescript-react-example
npm install
```This will install a local copy of the project. You will need to set up some environment variables before the app will run properly.
To integrate Okta's Identity Platform for user authentication, you'll first need to:
* [Sign up for a free Okta Developer account](https://www.okta.com/developer/signup/)
* You will get a URL similar to `https://dev-123456.oktapreview.com`.
* Save this URL for later
* You will also use this URL to login to your Okta accountYou will need to create an application in Okta:
* Log in to your Okta account, then navigate to **Applications** and click the **Add Application** button
* Select **Single-Page App** and click **Next**
* Give your application a name (e.g. "Real-Time Chat")
* Click **Done**
* Save your **Client ID** for laterYour Okta application should have settings similar to the following:
![Okta Application Settings](images/okta-app-settings.png)
You'll also need to create a token in Okta:
* From your Okta account, navigate to **Tokens** from the **API** dropwon in the header
* Click **Create Token**
* Give your token a name (e.g. "Real-Time Chat")
* Click **Done**
* Save your **Token** for later (if you lose this, you'll need to create another one)Now create a file called `.env` in the project root and add the following variables, replacing the values with your own from the previous steps.
**.env**
```bash
OKTA_ORG_URL=https://{yourOktaOrgUrl}
OKTA_CLIENT_ID={yourClientId}
OKTA_TOKEN={yourToken}
```Now you can run both the Node backend and the React frontend with the following command:
```bash
npm start
```## Links
This example uses the [Okta JWT Verifier](https://github.com/okta/okta-oidc-js/tree/master/packages/jwt-verifier), the [Okta Node SDK](https://github.com/okta/okta-sdk-nodejs), and the [Okta React SDK](https://github.com/okta/okta-oidc-js/tree/master/packages/okta-react).
## Help
Please [raise an issue](https://github.com/oktadeveloper/okta-node-express-typescript-react-example/issues) if you find a problem with the example application, or visit our [Okta Developer Forums](https://devforum.okta.com/). You can also email [[email protected]](mailto:[email protected]) if would like to create a support ticket.
## License
Apache 2.0, see [LICENSE](LICENSE).