Thanks Michael Lumish. Can you please confirm whether the below code is 
correct. I am worried whether there is some asynchronous problem. How to 
use auth_creds for the next function - 
grpc.credentials.combineChannelCredentials(ssl_creds, 
auth_creds) ?

function generateMetadata(params, callback) {
   var metadata = new grpc.Metadata();
   metadata.add('authorization', response.access_token);
   console.log(metadata); // *Prints second*
   callback(null,metadata);
}

var auth_creds = 
grpc.credentials.createFromMetadataGenerator(generateMetadata);
console.log(auth_creds); // *Prints first*
var combined_creds = grpc.credentials.combineChannelCredentials(ssl_creds, 
auth_creds);
var clientnew = new proto.Gateway('localhost:50001',combined_creds);
var cmd = {};
var call = clientnew.listAcousticSystems(cmd);
call.on('data', function(systems) {
   console.log(systems);
});



On Tuesday, May 23, 2017 at 3:36:18 PM UTC-3, Michael Lumish wrote:
>
> You got an error that says "Invalid Authorization Token". That error was 
> thrown by the call's "error" event handler, which means that that the call 
> ended with that error. That error message probably came from the server. 
> So, there is some problem with your access_token.
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/26ecaeea-e835-4516-875f-1c4d0af1a991%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to