jwtbutler 1.7.2 → 1.7.5
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/README.md +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ jwtbutler is a helper library for setting up a single sign on with jwt in a mult
|
|
|
4
4
|
|
|
5
5
|
## features
|
|
6
6
|
|
|
7
|
-
- works in all js
|
|
7
|
+
- works in all js-applications
|
|
8
8
|
- renders a simple loginform if needed
|
|
9
9
|
- requires no code changes on the auth server
|
|
10
10
|
- has a fetch helper function for api calls that do all the heavy lifting (e.g. refreshing token, repeating calls) under the hood
|
|
@@ -19,12 +19,12 @@ jwtbutler is a helper library for setting up a single sign on with jwt in a mult
|
|
|
19
19
|
|
|
20
20
|
- a fully setup jwt auth server (like [simpleauth](https://github.com/vielhuber/simpleauth)) with the following routes
|
|
21
21
|
|
|
22
|
-
| route
|
|
23
|
-
|
|
|
24
|
-
| /login | POST | email password | -- | `([ 'success' => true, 'message' => 'auth successful', 'public_message' => '...', 'data' => [ 'access_token' => '...', 'expires_in' => 3600, 'user_id' => 42 ] ], 200)` |
|
|
25
|
-
| /refresh | POST | -- | Authorization: Bearer token | `([ 'success' => true, 'message' => 'auth successful', 'public_message' => '...', 'data' => [ 'access_token' => '...', 'expires_in' => 3600, 'user_id' => 42 ] ], 200)` |
|
|
26
|
-
| /logout | POST | -- | Authorization: Bearer token | `([ 'success' => true, 'message' => 'logout successful', 'public_message' => '...' ], 200)` |
|
|
27
|
-
| /check | POST | access_token | -- | `([ 'success' => true, 'message' => 'valid token', 'public_message' => '...', 'data' => [ 'expires_in' => 3600, 'user_id' => 42, 'client_id' => 7000000 ] ], 200)` |
|
|
22
|
+
| route | method | arguments | header | response |
|
|
23
|
+
| ------------- | ------ | -------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| /auth/login | POST | email password | -- | `([ 'success' => true, 'message' => 'auth successful', 'public_message' => '...', 'data' => [ 'access_token' => '...', 'expires_in' => 3600, 'user_id' => 42 ] ], 200)` |
|
|
25
|
+
| /auth/refresh | POST | -- | Authorization: Bearer token | `([ 'success' => true, 'message' => 'auth successful', 'public_message' => '...', 'data' => [ 'access_token' => '...', 'expires_in' => 3600, 'user_id' => 42 ] ], 200)` |
|
|
26
|
+
| /auth/logout | POST | -- | Authorization: Bearer token | `([ 'success' => true, 'message' => 'logout successful', 'public_message' => '...' ], 200)` |
|
|
27
|
+
| /auth/check | POST | access_token | -- | `([ 'success' => true, 'message' => 'valid token', 'public_message' => '...', 'data' => [ 'expires_in' => 3600, 'user_id' => 42, 'client_id' => 7000000 ] ], 200)` |
|
|
28
28
|
|
|
29
29
|
- 401 response code on bad authentication
|
|
30
30
|
|
|
@@ -50,7 +50,7 @@ now instantiate the object with the basic configuration:
|
|
|
50
50
|
|
|
51
51
|
```js
|
|
52
52
|
const api = new jwtbutler({
|
|
53
|
-
auth_server: 'https://example-auth-server.vielhuber.dev',
|
|
53
|
+
auth_server: 'https://example-auth-server.vielhuber.dev/auth',
|
|
54
54
|
auth_login: 'email'
|
|
55
55
|
});
|
|
56
56
|
```
|
|
@@ -248,7 +248,7 @@ RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
|
|
|
248
248
|
|
|
249
249
|
setup the following vhosts:
|
|
250
250
|
|
|
251
|
-
- https://example-auth-server.vielhuber.dev => jwt auth server (like [simpleauth](https://github.com/vielhuber/simpleauth))
|
|
251
|
+
- https://example-auth-server.vielhuber.dev/auth => jwt auth server (like [simpleauth](https://github.com/vielhuber/simpleauth))
|
|
252
252
|
- https://example-auth-page1.vielhuber.dev => \_tests/page1
|
|
253
253
|
- https://example-auth-page2.vielhuber.dev => \_tests/page2
|
|
254
254
|
- https://example-auth-page3.vielhuber.dev => \_tests/page3
|