https://github.com/cs3org/node-cs3apis
Official Node.js CS3APIS
https://github.com/cs3org/node-cs3apis
cs3-apis nodejs
Last synced: 5 months ago
JSON representation
Official Node.js CS3APIS
- Host: GitHub
- URL: https://github.com/cs3org/node-cs3apis
- Owner: cs3org
- License: apache-2.0
- Created: 2021-04-13T09:19:46.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-11-11T14:29:42.000Z (7 months ago)
- Last Synced: 2026-01-17T01:25:46.112Z (5 months ago)
- Topics: cs3-apis, nodejs
- Language: JavaScript
- Homepage:
- Size: 580 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CS3APIS for Node.js
[](https://gitter.im/cs3org/CS3APIS) [](https://www.npmjs.com/package/@cs3org/node-cs3apis) [](https://drone.cernbox.cern.ch/cs3org/node-cs3apis) [](https://opensource.org/licenses/Apache-2.0)
API definitions can be found at https://github.com/cs3org/cs3apis
## Install with npm
```bash
npm i @cs3org/node-cs3apis
```
## Example usage
```js
const grpc = require('grpc');
const { GatewayAPIClient } = require('@cs3org/node-cs3apis/cs3/gateway/v1beta1/gateway_api_grpc_pb');
const { AuthenticateRequest } = require('@cs3org/node-cs3apis/cs3/gateway/v1beta1/gateway_api_pb');
const TARGET = process.env.TARGET || 'localhost:19000';
const client = new GatewayAPIClient(TARGET, grpc.credentials.createInsecure());
function authenticate(authType, clientId, clientSecret) {
const req = new AuthenticateRequest();
req.setType(authType);
req.setClientId(clientId);
req.setClientSecret(clientSecret);
return new Promise((resolve, reject) => {
client.authenticate(req, (err, response) => {
if (err) {
reject(err);
} else {
resolve(response);
}
});
});
}
async function example() {
try {
const res = await authenticate('basic', 'einstein', 'relativity');
// See:
// * AuthenticateResponse https://github.com/cs3org/cs3apis/blob/a86e5cb6ac360/cs3/gateway/v1beta1/gateway_api.proto#L415
// * User https://github.com/cs3org/cs3apis/blob/a86e5cb6ac360/cs3/identity/user/v1beta1/resources.proto#L53
console.log(res.getUser().getDisplayName());
} catch (e) {
console.error(e);
}
}
// ...
example();
```