Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Commit 3b6cd95

Browse files
authored
Update README.md
1 parent 3556871 commit 3b6cd95

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ const dgraphClient = new dgraph.DgraphClient(clientStub);
9898

9999
To facilitate debugging, [debug mode](#debug-mode) can be enabled for a client.
100100

101+
### Multi-tenancy
102+
103+
In [multi-tenancy](https://dgraph.io/docs/enterprise-features/multitenancy) environments, `dgraph-js-http` provides a new method `loginIntoNamespace()`,
104+
which will allow the users to login to a specific namespace.
105+
106+
In order to create a JavaScript client, and make the client login into namespace `123`:
107+
108+
```js
109+
const dgraphClientStub = new dgraph.DgraphClientStub("localhost:9080");
110+
await dgraphClientStub.loginIntoNamespace("groot", "password", 123); // where 123 is the namespaceId
111+
```
112+
113+
In the example above, the client logs into namespace `123` using username `groot` and password `password`.
114+
Once logged in, the client can perform all the operations allowed to the `groot` user of namespace `123`.
115+
101116
### Create a Client for Dgraph Cloud Endpoint
102117

103118
If you want to connect to Dgraph running on your [Dgraph Cloud](https://cloud.dgraph.io) instance, then all you need is the URL of your Dgraph Cloud endpoint and the API key. You can get a client using them as follows:

0 commit comments

Comments
 (0)