feat(API): Add optional projectId parameter to credential creation - #193
Open
everettbu wants to merge 9 commits into
Open
feat(API): Add optional projectId parameter to credential creation#193everettbu wants to merge 9 commits into
everettbu wants to merge 9 commits into
Conversation
Signed-off-by: Hi120ki <12624257+hi120ki@users.noreply.github.com>
Signed-off-by: Hi120ki <12624257+hi120ki@users.noreply.github.com>
Error: src/credentials/__tests__/credentials.service.test.ts(71,3): error TS2554: Expected 12 arguments, but got 13. Signed-off-by: Hi120ki <12624257+hi120ki@users.noreply.github.com>
… is not part of the project Signed-off-by: Hi120ki <12624257+hi120ki@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirror of n8n-io/n8n#21039
Original author: hi120ki
Summary
Previously, credentials created via the Public API were always saved to the user's personal project.
This change adds an optional projectId parameter to the POST /credentials endpoint, allowing credentials to be created in any project where the user has credential:create permission.
The implementation follows the pattern used in the REST API credential creation endpoint.
If projectId is not provided, the credential is saved to the user's personal project, maintaining backward compatibility.
Related Linear tickets, Github issues, and Community forum posts
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)Note
Expose optional projectId in credential creation to create credentials in a specified project with permission checks, updating services, OpenAPI, and tests.
POST /credentialsnow accepts optionalprojectId; handler forwards it tosaveCredentialand returns proper403/404on permission/not-found.projectId; responses add403and404.ProjectService.getProjectForCredentialCreationto resolve target project and enforcecredential:createpermissions; removed direct repository checks.saveCredentialwith/withoutprojectId.ProjectService.getProjectForCredentialCreation(success, forbidden, not found, optional transaction).Written by Cursor Bugbot for commit 512e5d4. This will update automatically on new commits. Configure here.