mirror of https://github.com/grpc/grpc-node.git
fix: use getRequestHeaders instead of getRequestMetadata
This commit is contained in:
parent
0cf120a663
commit
d78c49a648
|
@ -39,7 +39,7 @@
|
|||
"body-parser": "^1.15.2",
|
||||
"electron-mocha": "^3.1.1",
|
||||
"express": "^4.14.0",
|
||||
"google-auth-library": "^0.9.2",
|
||||
"google-auth-library": "^2.0.0",
|
||||
"google-protobuf": "^3.0.0",
|
||||
"istanbul": "^0.4.4",
|
||||
"lodash": "^4.17.4",
|
||||
|
|
|
@ -195,16 +195,17 @@ exports.createFromMetadataGenerator = function(metadata_generator) {
|
|||
exports.createFromGoogleCredential = function(google_credential) {
|
||||
return exports.createFromMetadataGenerator(function(auth_context, callback) {
|
||||
var service_url = auth_context.service_url;
|
||||
google_credential.getRequestMetadata(service_url, function(err, header) {
|
||||
if (err) {
|
||||
google_credential.getRequestHeaders(service_url)
|
||||
.then(function(header) {
|
||||
var metadata = new Metadata();
|
||||
metadata.add('authorization', header.Authorization);
|
||||
callback(null, metadata);
|
||||
})
|
||||
.catch(function(err) {
|
||||
common.log(constants.logVerbosity.INFO, 'Auth error:' + err);
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
var metadata = new Metadata();
|
||||
metadata.add('authorization', header.Authorization);
|
||||
callback(null, metadata);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue