Skip to content

Fix client auth config #5

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions 001-quickstart/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import gremlin from 'gremlin'
// </imports>

// <environment_variables>
const accountName = process.env.COSMOS_GREMLIN_ENDPOINT
const accountName = process.env.COSMOS_GREMLIN_ACCOUNT_NAME
const accountKey = process.env.COSMOS_GREMLIN_KEY
// </environment_variables>

// <authenticate_client>
const credentials = new gremlin.driver.auth.PlainTextSaslAuthenticator(
const authenticator = new gremlin.driver.auth.PlainTextSaslAuthenticator(
'/dbs/cosmicworks/colls/products',
`${accountKey}`
)
Expand All @@ -18,7 +18,7 @@ const credentials = new gremlin.driver.auth.PlainTextSaslAuthenticator(
const client = new gremlin.driver.Client(
`wss://${accountName}.gremlin.cosmos.azure.com:443/`,
{
credentials,
authenticator,
traversalsource: 'g',
rejectUnauthorized: true,
mimeType: 'application/vnd.gremlin-v2.0+json'
Expand Down
4 changes: 2 additions & 2 deletions 601-emulator/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import gremlin from 'gremlin'
// </imports>

// <client>
const credentials = new gremlin.driver.auth.PlainTextSaslAuthenticator(
const authenticator = new gremlin.driver.auth.PlainTextSaslAuthenticator(
'/dbs/db1/colls/coll1',
'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=='
)

const client = new gremlin.driver.Client(
'ws://localhost:8901/',
{
credentials,
authenticator,
traversalsource: 'g',
rejectUnauthorized: false,
mimeType: 'application/vnd.gremlin-v2.0+json'
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ This repo has a [devcontainer](https://containers.dev) environment making it eas
Configure your Azure Cosmos DB credentials as environment variables.

```bash
export COSMOS_ENDPOINT="<cosmos-account-URI>"
export COSMOS_KEY="<cosmos-account-PRIMARY-KEY>"
export COSMOS_GREMLIN_ACCOUNT_NAME="<cosmos-account-NAME>"
export COSMOS_GREMLIN_KEY="<cosmos-account-PRIMARY-KEY>"
```

> **💡 TIP**: If you don't have an Azure Cosmos DB account, [create a free account](https://cosmos.azure.com/try/).
Expand Down