Skip to content

Commit

Permalink
Merge pull request #23 from cis3296s24/timeToCsv
Browse files Browse the repository at this point in the history
Time access token created added to CSV
  • Loading branch information
tun82434 authored Apr 13, 2024
2 parents 858783d + 7449f84 commit 26f802f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions receiptifyv1/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const cors = require('cors');
require('dotenv').config();


const client_id = '035844db2ccb4d0698ab8e14bb12f27a';
const client_secret = '8bfd5a9fa7a44aedbf8bf8f513236b4f';
const client_id = '82641df2811b48b493da744446b6b90f';
const client_secret = 'e48944809f164d768c38ca1e9d850021';
//const privateKey = fs.readFileSync('AuthKey_A8FKGGUQP3.p8').toString();
const teamId = process.env.teamId;
const keyId = process.env.keyId;
Expand Down Expand Up @@ -280,8 +280,14 @@ app.get('/callback', function (req, res) {
})
);

// Gets time (year-month-day hour:min:sec)
var currentDate = new Date();
var access_time = currentDate.getFullYear() + '-' + (currentDate.getMonth()+1) + '-' + currentDate.getDate() + ' ' +
currentDate.getHours() + ':' + currentDate.getMinutes() + ':' + currentDate.getSeconds();
console.log("Token Access Time: ", access_time);

// Writing to users.csv (Database)
fs.appendFile('users.csv', ('\n'+ profile.display_name + ',' + access_token +',' + sessionID + ','), (err) => {
fs.appendFile('users.csv', ('\n'+ profile.display_name + ',' + access_token +',' + sessionID + ',' + access_time + ','), (err) => {
if (err)
{
console.error('Error: Could not write to database.');
Expand Down
2 changes: 1 addition & 1 deletion receiptifyv1/users.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
display_name, access_token, sessionID
display_name, access_token, sessionID, access_time

0 comments on commit 26f802f

Please sign in to comment.