Skip to content

Commit 11e99be

Browse files
committed
docs: update readmes
1 parent 2b4e766 commit 11e99be

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ with different setups.
77

88
Each example contains its own README with specific installation and run instructions.
99

10+
### Authorization Code Flow
11+
12+
Location: [/authorization-code](./authorization-code)
13+
14+
Minimal authorization code flow with express and fetch and in-memory DB.
15+
1016
### Server to server
1117

1218
Location: [/server2server](./server2server)

authorization-code/README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Authorization Code Grant Example
22

3+
> [!CAUTION]
4+
> Do not use this example in production 1:1. It is meant for educational purposes and
5+
> needs to be adapted to your specific use case. It is a minimal example that does not
6+
> include all necessary security measures.
7+
38
## Architecture
49

510
The authorization code workflow is described in
@@ -38,6 +43,7 @@ The authorization code workflow is described in
3843
- @node-oauth/express-oauth-server (uses @node-oauth/oauth2-server)
3944
- express
4045
- body-parser
46+
- cors
4147

4248
### Client dependencies
4349

@@ -46,14 +52,14 @@ The authorization code workflow is described in
4652

4753
## Installation and usage
4854

49-
Install dependencies in both provider and client directories:
55+
1. Install dependencies in both provider and client directories:
5056

5157
```shell
5258
$ cd provider && npm install
5359
$ cd ../client && npm install
5460
```
5561

56-
Create a `.env` file in the authorization-code/provider directory:
62+
2. Create a `.env` file in the authorization-code/provider directory:
5763

5864
```
5965
CLIENT_ID=testclient
@@ -64,7 +70,7 @@ USERNAME=demo
6470
PASSWORD=demo
6571
```
6672

67-
Create a `.env` file in the authorization-code/client directory:
73+
3. Create a `.env` file in the authorization-code/client directory:
6874

6975
```
7076
AUTH_SERVER=http://localhost:8080
@@ -73,28 +79,30 @@ CLIENT_SECRET=testsecret
7379
REDIRECT_URI=http://localhost:3000/callback
7480
```
7581

76-
Start the provider (authorization server + resource server):
82+
4. Start the provider (authorization server + resource server):
7783

7884
```shell
7985
$ cd provider && npm start
8086
```
8187

82-
Start the client application:
88+
5. Start the client application:
8389

8490
```shell
8591
$ cd client && npm start
8692
```
8793

88-
Visit http://localhost:3000 to start the authorization code flow.
94+
6. Visit http://localhost:3000 to start the authorization code flow.
8995

9096
## About This Example
9197

92-
This example demonstrates a clear separation between the OAuth2 provider (authorization server + resource server) and the client application. Unlike other examples that might combine both roles in a single application, this example shows:
98+
This example demonstrates a clear separation between the OAuth2 provider (authorization server + resource server)
99+
and the client application.
100+
Unlike other examples that might combine both roles in a single application, this example shows:
93101

94102
- **Provider** (port 8080): Acts as both authorization server and resource server
95103
- **Client** (port 3000): A separate web application that consumes OAuth2 services
96104

97-
This separation makes it easier to understand what the framework supports and what it doesn't.
105+
This separation makes it easier to understand what the `@node-oauth/oauth2-server` library supports and what it doesn't.
98106

99107
## Flow
100108

0 commit comments

Comments
 (0)