Skip to content

fix(core): Resolve managed OAuth endpoint fields from the credential type (no-changelog) - #36922

Queued
afitzek wants to merge 2 commits into
masterfrom
afitzek/iam-1222-managed-credential-field-resolution
Queued

fix(core): Resolve managed OAuth endpoint fields from the credential type (no-changelog)#36922
afitzek wants to merge 2 commits into
masterfrom
afitzek/iam-1222-managed-credential-field-resolution

Conversation

@afitzek

@afitzek afitzek commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

For managed OAuth credentials — where the instance supplies the OAuth client
through credential overwrites — the OAuth endpoint and flow fields now resolve
from the credential type definition instead of the stored credential data.

Key implementation decisions

  • Resolve-time rather than save-time: this also corrects credentials whose
    stored data was already set, with no data migration.
  • The values are read directly onto the resolved object, mirroring the existing
    dynamic-client-registration branch, so it does not depend on the defaults
    pass keeping hidden fields.

Related

Review / Merge checklist

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)

Review in cubic

@n8n-assistant

n8n-assistant Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

PR review overview

Based on ownership of the 3 changed files in this PR:

Ownership Files owned Share Source code Test files Misc
@n8n-io/catalysts 2 67% +17 / -1 +215 / -0 +0 / -0
@n8n-io/iam 1 33% +10 / -0 +0 / -0 +0 / -0
Total 3 100% +27 / -1 +215 / -0 +0 / -0

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@n8n-assistant n8n-assistant Bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Aug 24, 2026
@afitzek
afitzek marked this pull request as ready for review August 24, 2026 13:23

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)
Architecture diagram
sequenceDiagram
    participant W as Workflow Executor
    participant CH as CredentialsHelper
    participant CO as CredentialsOverwrites
    participant CT as CredentialTypes
    participant DB as Credentials Repository

    Note over W,DB: Runtime Credential Resolution Flow

    W->>CH: getDecrypted(credentialId)
    CH->>DB: Fetch encrypted credential data
    DB-->>CH: Data (JSON)
    CH->>CH: Decrypt data

    CH->>CO: usesManagedAuth(type, data)
    
    alt NEW: Is Managed OAuth Credential
        CO-->>CH: true
        CH->>CO: getOverwrites(type)
        CO-->>CH: Overwrite map (e.g. environment variables)
        
        loop For each Pinned Field (authUrl, grantType, etc.)
            CH->>CT: Get property definition for field
            CT-->>CH: Property (type: hidden, default: "...")
            
            alt NEW: Admin Overwrite exists
                CH->>CH: Set field to Admin Overwrite value
            else NEW: Fallback to Type Definition
                CH->>CH: CHANGED: Set field to Credential Type default value
            end
            Note right of CH: User-provided values for these<br/>fields are now ignored/discarded
        end

    else Standard Credential
        CO-->>CH: false
        CH->>CH: Use values from decrypted stored data
    end

    CH->>CH: Apply remaining non-pinned defaults
    CH-->>W: Resolved Credential Object (Ready for API call)
Loading

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

@n8n-io n8n-io deleted a comment from cubic-dev-ai Bot Aug 24, 2026
@afitzek
afitzek requested a review from a team August 24, 2026 14:12
@afitzek
afitzek enabled auto-merge August 24, 2026 14:40
@afitzek
afitzek added this pull request to the merge queue Aug 24, 2026
Any commits made after this event will not be merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants