@@ -21,24 +21,25 @@ and understand how to run and work with Dgraph.
2121
2222## Table of contents
2323
24- - [ Install] ( #install )
25- - [ Supported Versions] ( #supported-versions )
26- - [ Quickstart] ( #quickstart )
27- - [ Using a Client] ( #using-a-client )
28- - [ Creating a Client] ( #creating-a-client )
29- - [ Altering the Database] ( #altering-the-database )
30- - [ Creating a Transaction] ( #creating-a-transaction )
31- - [ Running a Mutation] ( #running-a-mutation )
32- - [ Running a Query] ( #running-a-query )
33- - [ Running an Upsert: Query + Mutation] ( #running-an-upsert-query--mutation )
34- - [ Running a Conditional Upsert] ( #running-a-conditional-upsert )
35- - [ Committing a Transaction] ( #committing-a-transaction )
36- - [ Cleanup Resources] ( #cleanup-resources )
37- - [ Debug mode] ( #debug-mode )
38- - [ Examples] ( #examples )
39- - [ Development] ( #development )
40- - [ Building the source] ( #building-the-source )
41- - [ Running tests] ( #running-tests )
24+ - [ Install] ( #install )
25+ - [ Supported Versions] ( #supported-versions )
26+ - [ Quickstart] ( #quickstart )
27+ - [ Using a Client] ( #using-a-client )
28+ - [ Creating a Client] ( #creating-a-client )
29+ - [ Altering the Database] ( #altering-the-database )
30+ - [ Creating a Transaction] ( #creating-a-transaction )
31+ - [ Running a Mutation] ( #running-a-mutation )
32+ - [ Running a Query] ( #running-a-query )
33+ - [ Running an Upsert: Query + Mutation] ( #running-an-upsert-query--mutation )
34+ - [ Running a Conditional Upsert] ( #running-a-conditional-upsert )
35+ - [ Committing a Transaction] ( #committing-a-transaction )
36+ - [ Cleanup Resources] ( #cleanup-resources )
37+ - [ Debug mode] ( #debug-mode )
38+ - [ Setting Metadata Headers] ( #setting-metadata-headers )
39+ - [ Examples] ( #examples )
40+ - [ Development] ( #development )
41+ - [ Building the source] ( #building-the-source )
42+ - [ Running tests] ( #running-tests )
4243
4344## Install
4445
@@ -418,6 +419,19 @@ dgraphClient.setDebugMode(true);
418419dgraphClient .setDebugMode (false );
419420```
420421
422+ ### Setting Metadata Headers
423+
424+ Metadata headers such as authentication tokens can be set through the context of gRPC methods. Below is an example of how to set a header named "auth-token".
425+
426+ ``` js
427+ // The following piece of code shows how one can set metadata with
428+ // auth-token, to allow Alter operation, if the server requires it.
429+
430+ var meta = new grpc.Metadata ();
431+ meta .add (' auth-token' , ' mySuperSecret' );
432+
433+ await dgraphClient .alter (op, meta);
434+ ```
421435
422436## Examples
423437
0 commit comments