Skip to content

Commit 498e32f

Browse files
authored
docs(login): Use client and add note for cloud. (#56)
1 parent f54ba7b commit 498e32f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,14 @@ which will allow the users to login to a specific namespace.
106106
In order to create a JavaScript client, and make the client login into namespace `123`:
107107

108108
```js
109-
const dgraphClientStub = new dgraph.DgraphClientStub("localhost:9080");
110-
await dgraphClientStub.loginIntoNamespace("groot", "password", 123); // where 123 is the namespaceId
109+
await dgraphClient.loginIntoNamespace("groot", "password", 123); // where 123 is the namespaceId
111110
```
112111

113112
In the example above, the client logs into namespace `123` using username `groot` and password `password`.
114113
Once logged in, the client can perform all the operations allowed to the `groot` user of namespace `123`.
115114

115+
If you're connecting to Dgraph Cloud, call `setCloudApiKey` before calling `loginIntoNamespace`.
116+
116117
### Create a Client for Dgraph Cloud Endpoint
117118

118119
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)