From 800634bb11d9887a803180a1c2dce83f3d92f404 Mon Sep 17 00:00:00 2001 From: Francisco Pessano Date: Mon, 25 Apr 2022 15:32:40 -0300 Subject: [PATCH] Changed the way that Notion code is sended to this API --- src/index.js | 3 +++ src/routes/authRouter.js | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 487690b..04b3415 100644 --- a/src/index.js +++ b/src/index.js @@ -23,6 +23,9 @@ app.use(function (req, res, next) { next(); }); +//Enable body json +app.use(Express.json()) + //Configure Handlebars const hbs = require('hbs') hbs.registerPartials(__dirname + '/../views/partials') diff --git a/src/routes/authRouter.js b/src/routes/authRouter.js index 8c8e5e2..84a8c1a 100644 --- a/src/routes/authRouter.js +++ b/src/routes/authRouter.js @@ -5,10 +5,12 @@ const axios = require('axios') router.post('/', async (req, res) => { + console.log(req.body) + async function requestAccessToken() { try { const reqData = { - code: req.headers.code, + code: req.body.code, grant_type: "authorization_code", redirect_uri: "https://telegram-to-notion.herokuapp.com/auth" }