Skip to content

Support passing an OAuth scope parameter in Snowflake client_credentials flow #58815

Closed

Description

@bmanan7

Description

Feature Description (Required)

Extend SnowflakeHook.get_oauth_token so that connections using the client_credentials grant can optionally provide an OAuth scope. The value should come from a new connection-extra field (for example oauth_scope) and be included in the POST body when requesting the token. Existing behavior stays unchanged if no scope is supplied.

Root Problem

Many identity providers including Okta require/ recommends a scope for client-credentials exchanges. The current hook sends only grant_type (and defaults to no scopes), so customers must either override the hook in their deployments or weaken their IdP policies.

User Impact (Required)

Without this option, users can’t complete the OAuth handshake with providers that mandate scopes. Connections fail with access_denied errors, forcing teams to ship custom patches or abandon client-credentials altogether.

Acceptance Criteria

A connection extra (e.g., oauth_scope) is documented and honored for Snowflake OAuth.
When the extra is present, get_oauth_token includes scope= in the token request.
Leaving the field empty preserves today’s behavior.
Unit tests cover the scope-enabled branch and the default path.

Docs Info Needed

Update the Snowflake connection how-to to list the new extra and explain when to use it.

User stories

No response

Additional Notes

Snowflake's OAuth docs allow scope in client-credentials, and IdPs like Okta enforce/ requires it most of the times. This mirrors the existing Azure pattern (azure_oauth_scope → sent as scope).

Use case/motivation

Many customer IdPs (e.g., Okta, Auth0) are commonly configured to require a scope for client-credentials flows. While not always mandatory, this is a typical security setup. Because SnowflakeHook.get_oauth_token can’t currently include a scope, these configurations cause token requests to fail, forcing users to apply custom patches or relax IdP settings. Supporting an optional scope field allows the hook to work with these standard enterprise configurations without workarounds.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:feature
    needs-triage
    on Nov 28, 2025
  2. added
    provider:snowflake
    on Nov 28, 2025
  3. SameerMesiah97 commented on Nov 28, 2025

    @SameerMesiah97
    Contributor

    Can this be assigned to me?

  4. added and removed
    needs-triage
    on Nov 28, 2025
  5. Vishalup29 commented on Nov 30, 2025

    @Vishalup29
    Contributor

    Hi, I am a first time contributor and have opened a PR for this issue: #58863
    Pls review. I am open to feedbacks and guidance.

  6. potiuk commented on Nov 30, 2025

    @potiuk
    Member

    First make sure it's green :)

  7. ali-m07 commented on Nov 30, 2025

    @ali-m07

    Hi! I'm interested in working on adding OAuth scope parameter support for Snowflake. Can I be assigned to this issue?

  8. SameerMesiah97 commented on Nov 30, 2025

    @SameerMesiah97
    Contributor

    I’ve opened a PR #58871 that addresses this issue. I’m aware of the existing PR #58863, but my PR considers cases that were not covered in the earlier implementation.

  9. Vishalup29 commented on Dec 1, 2025

    @Vishalup29
    Contributor

    @potiuk its all good, CI green and my PR strictly adheres to the scope of the changes needed by the issue description, No additional, unsought enhancements/improvements which are introduced in the PR(s) which were raised after mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:providersgood first issuekind:featureprovider:snowflake

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions