Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions apps/backend/src/routes/authRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@ router.post('/', async (req, res) => {
}

const auth = {
Authorization:
"Basic " +
Buffer.from(
`${process.env.NOTION_INTEGRATION_ID}:${process.env.NOTION_INTEGRATION_SECRET}`
).toString("base64"),
Authorization2: `Basic ${Buffer.from(
`${process.env.NOTION_INTEGRATION_ID}:${process.env.NOTION_INTEGRATION_SECRET}`
).toString("base64")}`,
};
Authorization:
'Basic ' +
Buffer.from(
`${process.env.NOTION_INTEGRATION_ID}:${process.env.NOTION_INTEGRATION_SECRET}`
).toString('base64'),
Authorization2: `Basic ${Buffer.from(
`${process.env.NOTION_INTEGRATION_ID}:${process.env.NOTION_INTEGRATION_SECRET}`
).toString('base64')}`
}

console.log(auth)

const response = await axios({
method: "POST",
url: "https://api.notion.com/v1/oauth/token",
data: reqData,
// auth: {
// username: Buffer.from(
// process.env.NOTION_INTEGRATION_ID.toString('base64')
// ),
// password: Buffer.from(
// process.env.NOTION_INTEGRATION_SECRET.toString('base64')
// )
// } // THANK YOU https://stackoverflow.com/questions/67534080/notion-api-invalid-client-oauth-integration/68699544#68699544?newreg=949504cf865c4a52b2c0ce7afe936c9b
Authorization: `Basic ${Buffer.from(
`${process.env.NOTION_INTEGRATION_ID}:${process.env.NOTION_INTEGRATION_SECRET}`
).toString("base64")}`,
});
method: 'POST',
url: 'https://api.notion.com/v1/oauth/token',
data: reqData,
// auth: {
// username: Buffer.from(
// process.env.NOTION_INTEGRATION_ID.toString('base64')
// ),
// password: Buffer.from(
// process.env.NOTION_INTEGRATION_SECRET.toString('base64')
// )
// } // THANK YOU https://stackoverflow.com/questions/67534080/notion-api-invalid-client-oauth-integration/68699544#68699544?newreg=949504cf865c4a52b2c0ce7afe936c9b
Authorization: `Basic ${Buffer.from(
`${process.env.NOTION_INTEGRATION_ID}:${process.env.NOTION_INTEGRATION_SECRET}`
).toString('base64')}`
})

console.log(response.status) // 400 in positive case
console.log(response.data)
Expand Down