Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Jan 30, 2024
1 parent 5ed41f5 commit 049165c
Showing 1 changed file with 45 additions and 19 deletions.
64 changes: 45 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
# Getting Started with Create React App
# @zitadel/react Example

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Authenticate your [ZITADEL](https://zitadel.com) users within your React applications.

## Available Scripts
> [!IMPORTANT]
> If you want to try out [@zitadel/react](https://www.npmjs.com/package/@zitadel/react), read the [ZITADEL step-by-step guide for React](https://zitadel.com/docs/examples/login/react).
> It shows how to get the _authority_ and _client_id_ from ZITADEL and how to wire everything up in React.
In the project directory, you can run:
## Project Structure

This project is a default React application created with [Create React App](https://create-react-app.dev/) that contains the ZITADEL React SDK to handle OIDC. The library is located in `/lib` folder and published as `@zitadel/react`.

![NPM Version](https://img.shields.io/npm/v/@zitadel/react)
![NPM License](https://img.shields.io/npm/l/@zitadel/react)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)

The following pages are added to the scaffolded example application:

- _src/components/Login.tsx_: The login page shows a button if no user is authenticated and redirects the user to /callback if authenticated.
- _src/components/Callback.tsx_: This page completes the auth flow and renders the retrieved information from the user info endpoint.

## Run

To run the example, navigate to the `/lib` folder and run `yarn build`.

```bash
cd /lib
yarn build
```

then navigate back and install the dependencies of the example application

```bash
cd ..
yarn install
```

Next follow the guide for React applications in our [docs](https://zitadel.com/docs/examples/login/react)
and set `authority` as well as `client_id` in the `App.tsx` file.
Finally you can start the application with

```bash
yarn start
```

Your application will then run on `http://localhost:3000`.

## Available scripts

### `yarn start`

Expand All @@ -14,11 +55,6 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.\
Expand All @@ -29,16 +65,6 @@ Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
Expand Down

0 comments on commit 049165c

Please sign in to comment.