@@ -4,6 +4,9 @@ Complete, compliant and well tested module for implementing an OAuth2 Server/Pro
4
4
5
5
[ ![ Tests] ( https://github.com/node-oauth/express-oauth-server/actions/workflows/tests.yml/badge.svg )] ( https://github.com/node-oauth/express-oauth-server/actions/workflows/tests.yml )
6
6
[ ![ CodeQL] ( https://github.com/node-oauth/express-oauth-server/actions/workflows/github-code-scanning/codeql/badge.svg )] ( https://github.com/node-oauth/express-oauth-server/actions/workflows/github-code-scanning/codeql )
7
+ [ ![ Project Status: Active – The project has reached a stable, usable state and is being actively developed.] ( https://www.repostatus.org/badges/latest/active.svg )] ( https://www.repostatus.org/#active )
8
+ [ ![ npm Version] ( https://img.shields.io/npm/v/@node-oauth/express-oauth-server?label=version )] ( https://www.npmjs.com/package/@node-oauth/oauth2-server )
9
+ [ ![ npm Downloads/Week] ( https://img.shields.io/npm/dw/@node-oauth/express-oauth-server )] ( https://www.npmjs.com/package/@node-oauth/oauth2-server )
7
10
![ GitHub] ( https://img.shields.io/github/license/node-oauth/express-oauth-server )
8
11
9
12
@@ -24,11 +27,11 @@ expect the request body to be parsed already.
24
27
The following example uses ` body-parser ` but you may opt for an alternative library.
25
28
26
29
``` js
27
- var bodyParser = require (' body-parser' );
28
- var express = require (' express' );
29
- var OAuthServer = require (' @node-oauth/express-oauth-server' );
30
+ const bodyParser = require (' body-parser' );
31
+ const express = require (' express' );
32
+ const OAuthServer = require (' @node-oauth/express-oauth-server' );
30
33
31
- var app = express ();
34
+ const app = express ();
32
35
33
36
app .oauth = new OAuthServer ({
34
37
model: {}, // See https://github.com/node-oauth/node-oauth2-server for specification
@@ -45,21 +48,31 @@ app.use(function(req, res) {
45
48
app .listen (3000 );
46
49
```
47
50
51
+ ## More Examples
52
+
53
+ For more examples, please visit [ our dedicated "examples" repo] ( https://github.com/node-oauth/node-oauth2-server-examples )
54
+ , which also contains express examples.
55
+
48
56
## Options
49
57
58
+ > Note: The following options ** extend** the default options from ` @node-oauth/oauth2-sever ` !
59
+ > You can read more about all possible options in the
60
+ > [ @node-oauth/oauth2-sever documentation] ( https://node-oauthoauth2-server.readthedocs.io/en/master/api/oauth2-server.html )
61
+
50
62
```
51
- var options = {
63
+ const options = {
52
64
useErrorHandler: false,
53
65
continueMiddleware: false,
54
66
}
55
67
```
56
- * ` useErrorHandler `
68
+
69
+ - ` useErrorHandler `
57
70
(_ type: boolean_ default: false)
58
71
59
72
If false, an error response will be rendered by this component.
60
73
Set this value to true to allow your own express error handler to handle the error.
61
74
62
- * ` continueMiddleware `
75
+ - ` continueMiddleware `
63
76
(_ type: boolean default: false_ )
64
77
65
78
The ` authorize() ` and ` token() ` middlewares will both render their
@@ -69,3 +82,7 @@ var options = {
69
82
** Note:** You cannot modify the response since the headers have already been sent.
70
83
71
84
` authenticate() ` does not modify the response and will always call next()
85
+
86
+ ## License
87
+
88
+ MIT, see
0 commit comments