...
 
Commits (2)
......@@ -670,6 +670,11 @@
}
}
},
"btoa": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz",
"integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g=="
},
"busboy": {
"version": "0.2.14",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz",
......
const btoa = require('btoa');
class AuthenticationHelper {
static basicAuthenticationCredential() {
// TODO: Credentials should be pulled from app itself.
let basicAuthCredential = `${process.env.DRUPAL_ADMIN_USERNAME}:${process.env.DRUPAL_ADMIN_PASSWORD}`;
return `Basic ${btoa(basicAuthCredential)}`;
}
}
module.exports = AuthenticationHelper;
const AuthenticationHelper = require('../authenticationHelper');
const { RESTDataSource } = require('apollo-datasource-rest');
class StandUpNotes extends RESTDataSource {
......@@ -35,10 +36,9 @@ class StandUpNotes extends RESTDataSource {
]
};
// TODO: Unhardcode authorization header.
const response = await this.post('node?_format=json', body, {
headers: {
"Authorization": "Basic YWRtaW46YWRtaW4=",
"Authorization": AuthenticationHelper.basicAuthenticationCredential(),
"Accept": "application/json",
"Content-Type": "application/json",
},
......