auth0 2.44.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +53 -137
- package/package.json +3 -4
- package/src/Auth0RestClient.js +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [v3.0.0](https://github.com/auth0/node-auth0/tree/v3.0.0) (2022-12-22)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.44.1...v3.0.0)
|
|
6
|
+
|
|
7
|
+
**⚠️ BREAKING CHANGES**
|
|
8
|
+
|
|
9
|
+
- Update jsonwebtoken [\#766](https://github.com/auth0/node-auth0/pull/766) ([adamjmcgrath](https://github.com/adamjmcgrath))
|
|
10
|
+
|
|
11
|
+
This release drops support for Node versions <14.
|
|
12
|
+
|
|
13
|
+
## [v2.44.1](https://github.com/auth0/node-auth0/tree/v2.44.1) (2022-12-09)
|
|
14
|
+
|
|
15
|
+
[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.44.0...v2.44.1)
|
|
16
|
+
|
|
17
|
+
**Fixed**
|
|
18
|
+
|
|
19
|
+
- Prevent calling the callback more than once [\#759](https://github.com/auth0/node-auth0/pull/759) ([snocorp](https://github.com/snocorp))
|
|
20
|
+
|
|
3
21
|
## [v2.44.0](https://github.com/auth0/node-auth0/tree/v2.44.0) (2022-10-11)
|
|
4
22
|
|
|
5
23
|
[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.43.0...v2.44.0)
|
package/README.md
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[![
|
|
5
|
-
|
|
6
|
-
[![License]
|
|
7
|
-
|
|
8
|
-
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fauth0%2Fnode-auth0?ref=badge_shield)
|
|
3
|
+

|
|
4
|
+
[](https://codecov.io/gh/auth0/node-auth0)
|
|
5
|
+

|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+

|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
📚 [Documentation](#documentation) - 🚀 [Getting Started](#getting-started) - 💻 [API Reference](#api-reference) - 💬 [Feedback](#feedback)
|
|
11
10
|
|
|
12
|
-
##
|
|
11
|
+
## Documentation
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```
|
|
13
|
+
- [FAQs](https://github.com/auth0/node-auth0/blob/master/FAQ.md) - frequently asked questions about node-auth0.
|
|
14
|
+
- [Docs Site](https://auth0.com/docs) - explore our docs site and learn more about Auth0
|
|
17
15
|
|
|
18
|
-
##
|
|
16
|
+
## Getting Started
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
### Requirements
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
This library supports the following tooling versions:
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
- Node.js: `>=8.3.0`
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
### Installation
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
Using [npm](https://npmjs.org) in your project directory run the following command:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install auth0
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Configure the SDK
|
|
33
|
+
|
|
34
|
+
#### Authentication API Client
|
|
29
35
|
|
|
30
36
|
This client must be used to access Auth0's [Authentication API](https://auth0.com/docs/api/authentication).
|
|
31
37
|
|
|
@@ -40,7 +46,9 @@ var auth0 = new AuthenticationClient({
|
|
|
40
46
|
});
|
|
41
47
|
```
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
#### Management API Client
|
|
50
|
+
|
|
51
|
+
> Note: When using the ManagementClient in a browser you should set `telemetry: false`.
|
|
44
52
|
|
|
45
53
|
The Auth0 Management API is meant to be used by back-end servers or trusted parties performing administrative tasks. Generally speaking, anything that can be done through the Auth0 dashboard (and more) can also be done through this API.
|
|
46
54
|
|
|
@@ -55,134 +63,42 @@ var management = new ManagementClient({
|
|
|
55
63
|
});
|
|
56
64
|
```
|
|
57
65
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
To obtain **automatically** a Management API token via the ManagementClient, you can specify the parameters `clientId`, `clientSecret` (use a Non Interactive Client) and optionally `scope`.
|
|
61
|
-
Behind the scenes the Client Credentials Grant is used to obtain the `access_token` and is by default cached for the duration of the returned `expires_in` value.
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
var ManagementClient = require('auth0').ManagementClient;
|
|
65
|
-
var auth0 = new ManagementClient({
|
|
66
|
-
domain: '{YOUR_ACCOUNT}.auth0.com',
|
|
67
|
-
clientId: '{YOUR_NON_INTERACTIVE_CLIENT_ID}',
|
|
68
|
-
clientSecret: '{YOUR_NON_INTERACTIVE_CLIENT_SECRET}',
|
|
69
|
-
scope: 'read:users update:users',
|
|
70
|
-
});
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
> Make sure your ClientId is allowed to request tokens from Management API in [Auth0 Dashboard](https://manage.auth0.com/#/apis)
|
|
74
|
-
|
|
75
|
-
To obtain a Management API token from your node backend, you can use Client Credentials Grant using your registered Auth0 Non Interactive Clients
|
|
76
|
-
|
|
77
|
-
```js
|
|
78
|
-
var AuthenticationClient = require('auth0').AuthenticationClient;
|
|
79
|
-
|
|
80
|
-
var auth0 = new AuthenticationClient({
|
|
81
|
-
domain: '{YOUR_ACCOUNT}.auth0.com',
|
|
82
|
-
clientId: '{CLIENT_ID}',
|
|
83
|
-
clientSecret: '{CLIENT_SECRET}',
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
auth0.clientCredentialsGrant(
|
|
87
|
-
{
|
|
88
|
-
audience: 'https://{YOUR_ACCOUNT}.auth0.com/api/v2/',
|
|
89
|
-
scope: '{MANAGEMENT_API_SCOPES}',
|
|
90
|
-
},
|
|
91
|
-
function (err, response) {
|
|
92
|
-
if (err) {
|
|
93
|
-
// Handle error.
|
|
94
|
-
}
|
|
95
|
-
console.log(response.access_token);
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Also you can request a token when the user authenticates using any of our client side SDKs, e.g. [auth0.js](https://github.com/auth0/auth0.js).
|
|
66
|
+
For other examples see the [EXAMPLES.md](https://github.com/auth0/node-auth0/blob/master/EXAMPLES.md) document.
|
|
101
67
|
|
|
102
|
-
##
|
|
68
|
+
## API Reference
|
|
103
69
|
|
|
104
|
-
|
|
70
|
+
- [AuthenticationClient](https://auth0.github.io/node-auth0/AuthenticationClient.html)
|
|
71
|
+
- [ManagementClient](https://auth0.github.io/node-auth0/ManagementClient.html)
|
|
105
72
|
|
|
106
|
-
|
|
107
|
-
// Using callbacks.
|
|
108
|
-
management.getUsers(function (err, users) {
|
|
109
|
-
if (err) {
|
|
110
|
-
// handle error.
|
|
111
|
-
}
|
|
112
|
-
console.log(users);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// Using promises.
|
|
116
|
-
management
|
|
117
|
-
.getUsers()
|
|
118
|
-
.then(function (users) {
|
|
119
|
-
console.log(users);
|
|
120
|
-
})
|
|
121
|
-
.catch(function (err) {
|
|
122
|
-
// Handle error.
|
|
123
|
-
});
|
|
124
|
-
```
|
|
73
|
+
## Feedback
|
|
125
74
|
|
|
126
|
-
|
|
75
|
+
### Contributing
|
|
127
76
|
|
|
128
|
-
|
|
77
|
+
We appreciate feedback and contribution to this repo! Before you get started, please see the following:
|
|
129
78
|
|
|
130
|
-
|
|
79
|
+
- [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)
|
|
80
|
+
- [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)
|
|
131
81
|
|
|
132
|
-
###
|
|
82
|
+
### Raise an issue
|
|
133
83
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
resolve: {
|
|
138
|
-
alias: {
|
|
139
|
-
'superagent-proxy': false
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
```
|
|
84
|
+
To provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/auth0/node-auth0/issues).
|
|
143
85
|
|
|
144
|
-
|
|
86
|
+
### Vulnerability Reporting
|
|
145
87
|
|
|
88
|
+
Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
|
146
89
|
|
|
147
90
|
## What is Auth0?
|
|
148
91
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
## Issue Reporting
|
|
164
|
-
|
|
165
|
-
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
|
166
|
-
|
|
167
|
-
## Author
|
|
168
|
-
|
|
169
|
-
[Auth0](https://auth0.com)
|
|
170
|
-
|
|
171
|
-
## License
|
|
172
|
-
|
|
173
|
-
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
|
174
|
-
|
|
175
|
-
<!-- Vaaaaarrrrsss -->
|
|
176
|
-
|
|
177
|
-
[npm-image]: https://img.shields.io/npm/v/auth0.svg?style=flat-square
|
|
178
|
-
[npm-url]: https://npmjs.org/package/auth0
|
|
179
|
-
[circleci-image]: https://img.shields.io/circleci/project/github/auth0/node-auth0.svg?branch=master&style=flat-square
|
|
180
|
-
[circleci-url]: https://circleci.com/gh/auth0/node-auth0
|
|
181
|
-
[codecov-image]: https://img.shields.io/codecov/c/github/auth0/node-auth0.svg?style=flat-square
|
|
182
|
-
[codecov-url]: https://codecov.io/github/auth0/node-auth0?branch=master
|
|
183
|
-
[license-image]: https://img.shields.io/npm/l/auth0.svg?style=flat-square
|
|
184
|
-
[license-url]: #license
|
|
185
|
-
[downloads-image]: https://img.shields.io/npm/dm/auth0.svg?style=flat-square
|
|
186
|
-
[downloads-url]: https://npmjs.org/package/auth0
|
|
187
|
-
|
|
188
|
-
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fauth0%2Fnode-auth0?ref=badge_large)
|
|
92
|
+
<p align="center">
|
|
93
|
+
<picture>
|
|
94
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png" width="150">
|
|
95
|
+
<source media="(prefers-color-scheme: light)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150">
|
|
96
|
+
<img alt="Auth0 Logo" src="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150">
|
|
97
|
+
</picture>
|
|
98
|
+
</p>
|
|
99
|
+
<p align="center">
|
|
100
|
+
Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href="https://auth0.com/why-auth0">Why Auth0?</a>
|
|
101
|
+
</p>
|
|
102
|
+
<p align="center">
|
|
103
|
+
This project is licensed under the MIT license. See the <a href="https://github.com/auth0/node-auth0/blob/master/LICENSE"> LICENSE</a> file for more info.
|
|
104
|
+
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "SDK for Auth0 API v2",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"url": "https://github.com/auth0/node-auth0"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">=14"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"auth0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"axios": "^0.27.2",
|
|
37
37
|
"form-data": "^3.0.1",
|
|
38
|
-
"jsonwebtoken": "^
|
|
38
|
+
"jsonwebtoken": "^9.0.0",
|
|
39
39
|
"jwks-rsa": "^1.12.1",
|
|
40
40
|
"lru-memoizer": "^2.1.4",
|
|
41
41
|
"rest-facade": "^1.16.3",
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
"mocha-junit-reporter": "^2.0.0",
|
|
60
60
|
"nock": "^13.2.7",
|
|
61
61
|
"nyc": "^14.1.1",
|
|
62
|
-
"pem": "^1.14.2",
|
|
63
62
|
"prettier": "2.4.1",
|
|
64
63
|
"pretty-quick": "^1.11.1",
|
|
65
64
|
"proxyquire": "^2.1.3",
|
package/src/Auth0RestClient.js
CHANGED
|
@@ -73,9 +73,12 @@ class Auth0RestClient {
|
|
|
73
73
|
this.restClient[method](...args, (err, data, headers) => {
|
|
74
74
|
const payload = { data, headers };
|
|
75
75
|
if (err) {
|
|
76
|
-
(callback
|
|
76
|
+
if (callback) callback(err);
|
|
77
|
+
else reject(err);
|
|
78
|
+
return;
|
|
77
79
|
}
|
|
78
|
-
(callback
|
|
80
|
+
if (callback) callback(null, payload);
|
|
81
|
+
else resolve(payload);
|
|
79
82
|
});
|
|
80
83
|
});
|
|
81
84
|
}
|