Credentials working in Test but failing in Active Workflow

My OAuth2 credential works in manual execution but fails with 401 in the active workflow. Token refresh appears successful. Could this be related to encrypted credential storage or instance restarts invalidating the session?

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like

Hi @Joseph_Iko Welcome to the community!
Can you please share the details about which platform credentials fail at published mode?

Thanks for the welcome.

The failing credentials are for Google Sheets (OAuth2). the manual execution works perfectly and the token refresh completes without visible errors. However, once the workflow is activated, the same request returns a 401.

not home presently but will share logs or environment details if needed.

1 Like

@Joseph_Iko It is likely because that your google Oauth is in testing mode, try setting that in production mode.

1 Like

Hey @Joseph_Iko

This is usually caused by one of the following:

  • The encryption key (N8N_ENCRYPTION_KEY) changed between runs ( previously stored credentials can no longer be decrypted correctly)
  • Clock drift between your server and the OAuth provider, causing tokens to be considered expired immediately.
  • missing persistent storage for the .n8n directory in containerized deployments.

Ensure that:

  • The encryption key is static and consistent across restarts.
  • Your server time is synchronized via NTP.
  • and your credential storage is on a persistent volume.
2 Likes

oh, thanks

Will check it

1 Like

it’s a long list of things to follow

Anyways, thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.