Skip to content

docs(login): Use client and add note for cloud. #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ which will allow the users to login to a specific namespace.
In order to create a JavaScript client, and make the client login into namespace `123`:

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

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

If you're connecting to Dgraph Cloud, call `setCloudApiKey` before calling `loginIntoNamespace`.

### Create a Client for Dgraph Cloud Endpoint

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:
Expand Down