|
|
@ -91,7 +91,7 @@ exports.createSsl = ChannelCredentials.createSsl; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
exports.createFromMetadataGenerator = function(metadata_generator) { |
|
|
|
exports.createFromMetadataGenerator = function(metadata_generator) { |
|
|
|
return CallCredentials.createFromPlugin(function(service_url, callback) { |
|
|
|
return CallCredentials.createFromPlugin(function(service_url, callback) { |
|
|
|
metadata_generator(service_url, function(error, metadata) { |
|
|
|
metadata_generator({service_url: service_url}, function(error, metadata) { |
|
|
|
var code = grpc.status.OK; |
|
|
|
var code = grpc.status.OK; |
|
|
|
var message = ''; |
|
|
|
var message = ''; |
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
@ -114,7 +114,8 @@ exports.createFromMetadataGenerator = function(metadata_generator) { |
|
|
|
* @return {CallCredentials} The resulting credentials object |
|
|
|
* @return {CallCredentials} The resulting credentials object |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
exports.createFromGoogleCredential = function(google_credential) { |
|
|
|
exports.createFromGoogleCredential = function(google_credential) { |
|
|
|
return exports.createFromMetadataGenerator(function(service_url, callback) { |
|
|
|
return exports.createFromMetadataGenerator(function(auth_context, callback) { |
|
|
|
|
|
|
|
var service_url = auth_context.service_url; |
|
|
|
google_credential.getRequestMetadata(service_url, function(err, header) { |
|
|
|
google_credential.getRequestMetadata(service_url, function(err, header) { |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
callback(err); |
|
|
|
callback(err); |
|
|
|