@c8y/client 1018.485.16 → 1018.486.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 +15 -3
- package/lib/bundles/client.umd.js +11488 -11338
- package/lib/bundles/client.umd.js.map +1 -1
- package/lib/bundles/client.umd.min.js +1 -1
- package/lib/bundles/client.umd.min.js.map +1 -1
- package/lib/cjs/src/Client.js +102 -5
- package/lib/cjs/src/Client.js.map +1 -1
- package/lib/cjs/src/core/BearerAuth.js +32 -0
- package/lib/cjs/src/core/BearerAuth.js.map +1 -0
- package/lib/cjs/src/core/MicroserviceClientRequestAuth.js.map +1 -1
- package/lib/cjs/src/core/NodeJSCookieAuth.js +21 -0
- package/lib/cjs/src/core/NodeJSCookieAuth.js.map +1 -0
- package/lib/cjs/src/core/index.js +2 -0
- package/lib/cjs/src/core/index.js.map +1 -1
- package/lib/esm2015/src/Client.js +110 -5
- package/lib/esm2015/src/Client.js.map +1 -1
- package/lib/esm2015/src/core/BearerAuth.js +28 -0
- package/lib/esm2015/src/core/BearerAuth.js.map +1 -0
- package/lib/esm2015/src/core/MicroserviceClientRequestAuth.js.map +1 -1
- package/lib/esm2015/src/core/NodeJSCookieAuth.js +17 -0
- package/lib/esm2015/src/core/NodeJSCookieAuth.js.map +1 -0
- package/lib/esm2015/src/core/index.js +2 -0
- package/lib/esm2015/src/core/index.js.map +1 -1
- package/lib/src/Client.d.ts +71 -1
- package/lib/src/core/BearerAuth.d.ts +12 -0
- package/lib/src/core/MicroserviceClientRequestAuth.d.ts +4 -4
- package/lib/src/core/NodeJSCookieAuth.d.ts +10 -0
- package/lib/src/core/index.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,8 +69,9 @@ All fetch responses with `application/json` content type can be parsed to JSON o
|
|
|
69
69
|
|
|
70
70
|
In the Cumulocity platform we currently allow two ways to authenticate:
|
|
71
71
|
|
|
72
|
-
* Basic Auth: The authentication header is injected into each request.
|
|
73
|
-
* OAI: The client doesn't know about the authentication header. The header is set in a cookie.
|
|
72
|
+
* Basic Auth: The authentication header (Basic) is injected into each request.
|
|
73
|
+
* OAI (via cookie): The client doesn't know about the authentication header. The header is set in a cookie.
|
|
74
|
+
* OAI (via token): The client requests a token. An authentication header (Bearer) is injected into each request.
|
|
74
75
|
|
|
75
76
|
To quickly get you started, the @c8y/client provides a shorthand static function which always uses Basic Auth and verifies the login directly:
|
|
76
77
|
|
|
@@ -91,9 +92,20 @@ It internally creates a client instance and tries to contact the API to verify i
|
|
|
91
92
|
}
|
|
92
93
|
```
|
|
93
94
|
|
|
94
|
-
|
|
95
95
|
> *Note*: As the default login mode for UI is OAI, you usually don't need to authenticate via Basic Auth.
|
|
96
96
|
|
|
97
|
+
To login via OAI and use a Cookie for authentication you can use:
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
const client = await Client.getOAuthInternalClientViaCookie({ tenant, user, password }, url);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
To login via OAI and use the authentication header for authentication you can use:
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
const client = await Client.authenticateViaOAuthInternal({ tenant, user, password }, url);
|
|
107
|
+
```
|
|
108
|
+
|
|
97
109
|
## Examples
|
|
98
110
|
|
|
99
111
|
Below some examples are provided which may help you to get started. To see a complex and full implementation of the client into Angular, have a look at [@c8y/cli](https://www.npmjs.com/package/@c8y/cli) and the `new` command to spin up a example application for Angular.
|