Authorization failed - please check your credentials Missing bearer or basic authentication in header

My OpenAI Nodes is not working any more

Authorization failed - please check your credentials
Missing bearer or basic authentication in header

In Credentials the OpenAI API Key is valid and test is “green”.

What’s going on? n8n Version

1.123.20

@holgerdeha

which exact node is throwing this error? (like the regular OpenAI node, the AI Chat Model, or an HTTP Request node?) knowing that will help narrow down the fix.

it’s the regular OpenAI Node

1 Like

Hi @holgerdeha Most probably this issue is because your n8n instance is too old, consider updating your n8n instance to the latest stable version and your issue would be resolved!

I’m at the latest 1.x Version according to the release notes.

For testing: i created a new workflow with the same credentials and tried to select a model from the list. I get this error:

Could not load list

401 - Authorization failed

Missing bearer authentication in header

Check your credential

If i click on “Check your credentials”, the Credentials open and i can see this:

Connection tested successfully
—-
Transition to 2.x is not easily possible at the moment due to read/write issues in the /data volume.

1 Like

I mean the 2.x version of n8n:

It has a lot of issues fixed related to auth.

Quick fix to try first @holgerdeha

  1. Open the OpenAI node

  2. Click on the credential dropdown

  3. Select “Create New Credential”

  4. Paste your API key again

  5. Test and save

check these inside your openai credential settings:

1. if you are using a custom api base url, check the very end of it. make sure it does not end with a slash (like .../v1/). delete it if it’s there.

2. the organization id field: make sure this box is completely empty. sometimes invisible spaces or the gray placeholder text gets accidentally saved in there.

after checking both, go back into your openai node and manually re-select the credential from the dropdown to force it to refresh.

The credentials test passing but the node itself failing is a weird one, usually that points to something in the credential config being off. The custom API base URL ending with a slash is actually a common gotcha, same with invisible characters in the organization ID field. Worth double-checking both of those even if they look empty at first glance. If that doesn’t do it, try creating a completely fresh credential with a brand new API key from OpenAI’s dashboard rather than reusing the same key, sometimes keys get into a weird state on OpenAI’s end.

this didn’t work

  1. i didn’t use this
  2. i didn’t have the organzition filed

So this didn’t work either.

both things didn’t work

You should consider updating n8n to the latest stable version.