>
> function generateMetadata(params, callback) {
>>> var metadata = new grpc.Metadata();
>>> metadata.add('authorization', response.access_token);
>>> console.log(metadata);
>>> callback(null,metadata);
>>> }
>>> var auth_creds =
>>> grpc.credentials.createFromMetadataGenerator(generateMetadata);
>>> console.log(auth_creds);
>>> 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);
>>> });
>>>
>>> I tried to do as suggested. I also remember that I've tried do like this
before as well. But unfortunately I was getting error in events.js and
client.js in node modules (which cannot be found in mentioned url). Below
I've attached the error which I got during the above method.
I20170523-15:18:27.515(-3)? CallCredentials {}
I20170523-15:18:27.532(-3)? Metadata {
I20170523-15:18:27.534(-3)? _internal_repr: { authorization: [
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ2ZW1jby5pbyIsImF1ZCI6InZlbWNvLmlvIiwic3ViIjoiMTFkZWVmMDUtOWUzNy00ZDQxLWJmNjgtZTE0MTQwY2IxODJmIiwiaWF0IjoxNDk1NTYzNTA3LCJleHAiOjE0OTU1NjQ0MDcsInVzZXJfbmFtZSI6InVzZXIxIn0.nLOa2c1PWWL59AIaiZjpzT_p0wSeUIoOsxsUHarTWCE'
] } }
W20170523-15:18:27.574(-3)? (STDERR) events.js:141
W20170523-15:18:27.575(-3)? (STDERR) throw er; // Unhandled 'error'
event
W20170523-15:18:27.582(-3)? (STDERR) ^
W20170523-15:18:27.583(-3)? (STDERR)
W20170523-15:18:27.589(-3)? (STDERR) Error: Invalid Authorization Token
W20170523-15:18:27.590(-3)? (STDERR) at
ClientReadableStream._emitStatusIfDone
(C:\Users\prasanna.elangovan\Desktop\Meteor_Practice\node_modules\grpc\src\node\src\client.js:201:19)
W20170523-15:18:27.598(-3)? (STDERR) at
ClientReadableStream._receiveStatus
(C:\Users\prasanna.elangovan\Desktop\Meteor_Practice\node_modules\grpc\src\node\src\client.js:180:8)
W20170523-15:18:27.600(-3)? (STDERR) at
C:\Users\prasanna.elangovan\Desktop\Meteor_Practice\node_modules\grpc\src\node\src\client.js:592:14
=> Exited with code: 1
I'm also wondering that auth_creds printed before metadata
Thanks for helping me on this.
--
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/150acf63-326d-432e-a0f9-403b8987c27a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.