Hey everyone, I’m having a weird issue with my Notion integration. It was working fine until a few days ago, but now it’s acting up. The access token suddenly stopped working for a bunch of accounts in our React and Node.js app. When we try to use the Notion REST API, we get this error:
{
object: 'error',
status: 401,
code: 'unauthorized',
message: 'API token is invalid.'
}
I’ve looked through the Notion docs, but I can’t figure out how to refresh the access tokens. I tried the POST request to get a new token, and this is what I got back:
{
access_token: 'some_token',
token_type: 'bearer',
bot_id: 'some_id',
workspace_name: 'My Workspace',
workspace_icon: 'some_url',
workspace_id: 'some_id',
owner: { type: 'user', user: {} },
duplicated_template_id: null
}
The docs mention something about refresh tokens, but it’s not clear how to use them. Does anyone know how to create a refresh token or where I can find more info on this? An example of how to generate a refresh token and use it to get a new access token would be super helpful. Thanks!
I have encountered similar issues with Notion API authentication and found that the solution often lies in verifying several aspects of the integration. In my experience, it is essential to first confirm that the integration is active and the right token is being used when making API calls. I also made sure that the permissions for accessing the relevant pages and databases were correctly configured. Occasionally, system updates or workspace changes can affect the token’s validity. If these checks do not resolve the issue, creating a new integration and using the new token has worked as an effective temporary measure. It might also be beneficial to contact Notion support for further insights.
I’ve dealt with this exact issue recently. From my experience, Notion doesn’t actually use refresh tokens in the traditional OAuth sense. Their access tokens are designed to be long-lived and don’t expire unless manually revoked. What likely happened is that the integration’s permissions were changed or the token was inadvertently revoked. My suggestion would be to go to the Notion integrations page, delete the current integration, and create a new one. This will generate a fresh token. Make sure to update your app with this new token. Also, double-check that the integration has all the necessary capabilities enabled for your use case. If the problem persists, it might be worth reaching out to Notion’s developer support for a more in-depth investigation.
hey emmat83, sounds like a real pain! i’ve had similar issues before. have u tried regenerating the access token in ur notion settings? sometimes that does the trick. also, double-check if ur integration still has the right permissions. if nothing works, maybe hit up notion support - they can be pretty helpful with these weird auth problems.