I am experimenting with Firebase cloud functions and PDFs. I would like to send a PDF via email and save the Access token in Firebase database. My cloudfunctions looks like current code:
exports.invoice = functions
.https
.onRequest( (req, res) => {
const myPdfFile = admin.storage().bucket().file('/test/Arbeitsvertrag-2.pdf');
const doc = new pdfkit({ margin: 50 });
const stream = doc.pipe(myPdfFile.createWriteStream());
doc.fontSize(25).text('Test 4 PDF!', 100, 100);
doc.end();
return res.send('Arbeitsvertrag-2.pdf');
});
Via this code a PDF is stored in firebase storage.
Only no access token is created. Is there any way to do this by default?