Using a public API integration with Notion, I encounter a ‘Missing or invalid redirect_uri’ error. The provided HTML link and backend route seem misconfigured. See examples below:
<html>
<head>
<meta charset="utf-8">
<title>Integration Test</title>
</head>
<body>
<a href="https://api.notion.com/v1/oauth/authorize?client_id=NEW_CLIENT&redirect_uri=https%3A%2F%2Fexample-app.com%2Fauth%2Fcallback&response_type=code">Authorize Notion</a>
</body>
</html>
app.get("/auth/callback/:authCode/:token", (req, res) => {
const authCode = req.params.authCode;
const token = req.params.token;
console.log(authCode);
res.json({ status: "Success", code: authCode, token: token });
axios.post('https://api.notion.com/v1/oauth/token', {
grant_type: "authorization_code",
code: authCode,
redirect_uri: 'https://example-app.com/auth/callback'
})
.then(response => console.log(response))
.catch(error => console.error(error));
});