Notion API, Getting Invalid_Grant when trying to generate authorization token
Try removing the redirect_uri from both the authorize call and the token exchange. The accepted answer reports that dropping redirect_uri from both steps returned a success response from the server. So the authorize URL becomes just client_id and response_type=code, and the token POST carries only grant_type and code. If you do pass a redirect_uri, it must be byte-identical in both calls and match what is registered on the integration settings page.
Try removing the redirecturi from both the authorize call and the token exchange. The accepted answer reports that dropping redirecturi from both steps returned a success response from the server. So the authorize URL becomes just clientid and responsetype=code, and the token POST carries only granttype and code. If you do pass a redirecturi, it must be byte-identical in both calls and match what is registered on the integration settings page.
Context: Stack Overflow question (score 8, has accepted answer): After creating a Notion integration and completing the browser authorize step, exchanging the interim code at the Notion token endpoint returns {"error": "invalidgrant"}. The token request posts granttype=authorizationcode with the code and a redirecturi to https://api.notion.com/v1/oauth/token.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.