Skip to content

Commit

Permalink
Update auth token usage (#348)
Browse files Browse the repository at this point in the history
* Update auth token usage

* trunk fmt
  • Loading branch information
octref authored Feb 5, 2025
1 parent 9bbd5b7 commit 9b20f55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"publicUrl": "/",
"cdnUrl": "https://d1ocqy7wcgv7nr.cloudfront.net/",
"scripts": {
"start": "node scripts/start.js",
"start": "cross-env CI=false NODE_OPTIONS=--openssl-legacy-provider node scripts/start.js",
"build": "cross-env CI=false NODE_OPTIONS=--openssl-legacy-provider node scripts/build.js",
"build:prod": "cross-env CI=false NODE_OPTIONS=--openssl-legacy-provider node scripts/build.js",
"build:local": "cross-env CI=false NODE_OPTIONS=--openssl-legacy-provider node scripts/build.js",
Expand Down
6 changes: 5 additions & 1 deletion client/src/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export function setCurrentServerSlashApiKey(slashApiKey) {

export function setCurrentServerAuthToken(authToken) {
clientStubOptions.headers["X-Dgraph-AuthToken"] = authToken;
clientStubOptions.headers["Authorization"] = authToken;
}

export const getDgraphClient = async () =>
Expand Down Expand Up @@ -156,7 +157,10 @@ export async function executeAdminGql(query, variables) {
const client = await getDgraphClientStub();
return await client.callAPI("admin", {
method: "POST",
headers: { ...clientStubOptions.headers, "Content-Type": "application/json" },
headers: {
...clientStubOptions.headers,
"Content-Type": "application/json",
},
body: JSON.stringify({
query,
variables,
Expand Down

0 comments on commit 9b20f55

Please sign in to comment.