Skip to content

[API Node] Allow authentification via Comfy API key#3815

Merged
huchenlei merged 9 commits intomainfrom
conditional-auth-header
May 9, 2025
Merged

[API Node] Allow authentification via Comfy API key#3815
huchenlei merged 9 commits intomainfrom
conditional-auth-header

Conversation

@christian-byrne
Copy link
Contributor

@christian-byrne christian-byrne commented May 8, 2025

Allow user to log in with an API key generated from https://platform.comfy.org/login.

This enables usage of API nodes in cases where, for example

  • The user is on non-whitelisted domain (e.g., cloud service, accessing home PC via tablet)
  • The user wants to add various API keys they have to their account and have convenience of still using API nodes

In general, however, the use of API keys will mainly benefit people running ComfyUI with a separate frontend or headlessly, or services embedding ComfyUI into their own product.

comfy-api-key-blurred.mp4

┆Issue is synchronized with this Notion page by Unito

@christian-byrne christian-byrne marked this pull request as ready for review May 8, 2025 01:26
Copy link
Contributor

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the api key signin form is parallel to

  • password signin + social account signin
  • password signup + social account signup

Shall we refactor the logic in SignInContent.vue to better capture this? Currently the showApiKeyForm flag is not representing this parallelism well.

@christian-byrne
Copy link
Contributor Author

Shall we refactor the logic in SignInContent.vue to better capture this? Currently the showApiKeyForm flag is not representing this parallelism well.

Sure, thanks.

@christian-byrne
Copy link
Contributor Author

christian-byrne commented May 9, 2025

Actually I'm not positive what you mean exactly. Do you mean have separate states for logging in with API key vs. signing up with API key?

@huchenlei
Copy link
Contributor

Actually I'm not positive what you mean exactly. Do you mean have separate states for logging in with API key vs. signing up with API key?

What I mean is that instead of having showApiKeyForm in multiple v-if conditions, can we just lift it to the top level and only have it in one v-if.

@christian-byrne
Copy link
Contributor Author

What I mean is that instead of having showApiKeyForm in multiple v-if conditions, can we just lift it to the top level and only have it in one v-if.

Thanks, that does seem better.

@christian-byrne
Copy link
Contributor Author

Changes:

  • Instead of having showApiKeyForm in multiple v-if conditions, lift it to the top level and only have it in one v-if
  • Move all API key form elements to the ApiKeyForm component
  • Add description subtext and links to recently created API key login tutorial: https://docs.comfy.org/interface/user#logging-in-with-an-api-key
  • Add component test for ApiKeyForm

@huchenlei huchenlei merged commit 34b1fd5 into main May 9, 2025
2 checks passed
@huchenlei huchenlei deleted the conditional-auth-header branch May 9, 2025 17:42
christian-byrne added a commit that referenced this pull request May 9, 2025
Co-authored-by: github-actions <github-actions@github.com>
christian-byrne added a commit that referenced this pull request May 20, 2025
Co-authored-by: github-actions <github-actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants