Skip to content

Keep Running the 401 Error even placed the .ENV file and API Key #40

@ZH79doc

Description

@ZH79doc

As the title stated, I keep getting 401 error even with .ENV and API Key placed correctly.

Asked GPT to see if anything went wrong and it says:

The main function generate_image() does not call get_access_token() — it relies on the token being passed in from outside.

From your traceback earlier:

generate_image(self.access_token, ...)

So, if self.access_token is not loaded via get_access_token(), the .env file is never read.

Then it sugguested to edit the following in nodes.py:

zipped_bytes = generate_image(self.access_token, positive, model, action, params, timeout, retry)

to:

from .utils import get_access_token # Add this at top if not already imported

access_token = get_access_token()
zipped_bytes = generate_image(access_token, positive, model, action, params, timeout, retry)

I edited as it says and now it works!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions