Skip to content

feat: support specifying client_id on oauth2 client creation#128

Merged
KT-Doan merged 1 commit intomainfrom
feat/oauth2-custom-client-id
Mar 17, 2026
Merged

feat: support specifying client_id on oauth2 client creation#128
KT-Doan merged 1 commit intomainfrom
feat/oauth2-custom-client-id

Conversation

@KT-Doan
Copy link
Copy Markdown
Collaborator

@KT-Doan KT-Doan commented Mar 17, 2026

Description

Support specifying a custom client_id when creating OAuth2 client resources, matching the Ory API's existing capability. This allows users to maintain consistent naming conventions across environments (e.g., migrating from self-hosted Hydra to Ory Network).

Related Issues

Fixes #121

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the existing code style
  • I have added tests that prove my fix/feature works
  • I have updated documentation as needed
  • All new and existing tests pass (make test)
  • I have run the linter (make format)

Testing

  • Unit tests
  • Acceptance tests
  • Manual testing

Changes

Schema (internal/resources/oauth2client/resource.go):

  • Changed client_id attribute from Computed to Optional+Computed
  • Added RequiresReplace() plan modifier (changing client_id forces recreation)

Create (internal/resources/oauth2client/resource.go):

  • Pass user-specified client_id to the Ory API on creation

Tests (internal/resources/oauth2client/resource_test.go):

  • Added TestAccOAuth2ClientResource_withCustomClientID covering create, import, and update with a custom client_id

Documentation:

  • Updated templates/resources/oauth2_client.md.tmpl with Custom Client ID section
  • Added example in examples/resources/ory_oauth2_client/resource.tf
  • Updated inline schema description

Acceptance Test Results

All 9 OAuth2 client acceptance tests pass:

--- PASS: TestAccOAuth2ClientResource_basic (5.45s)
--- PASS: TestAccOAuth2ClientResource_withAudience (3.14s)
--- PASS: TestAccOAuth2ClientResource_withRedirectURIs (3.28s)
--- PASS: TestAccOAuth2ClientResource_withNewFields (3.54s)
--- PASS: TestAccOAuth2ClientResource_withConsentAndSubjectType (3.63s)
--- PASS: TestAccOAuth2ClientResource_withJWKS (5.23s)
--- PASS: TestAccOAuth2ClientResource_withResourceCredentials (3.55s)
--- PASS: TestAccOAuth2ClientResource_withCustomClientID (5.52s)
--- PASS: TestAccOAuth2ClientResource_withTokenLifespans (3.53s)

Security Scans

All pass clean:

  • make sec (govulncheck, gosec, gitleaks) - 0 issues
  • make sec-trivy - 0 findings
  • make licenses - passed

Allow users to specify a custom `client_id` when creating an OAuth2
client resource, matching the Ory API capability. The field is
Optional+Computed with RequiresReplace, so changing it forces recreation.

Closes #121
Copilot AI review requested due to automatic review settings March 17, 2026 05:04
@KT-Doan KT-Doan self-assigned this Mar 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@KT-Doan KT-Doan merged commit 0be7d9a into main Mar 17, 2026
11 checks passed
@KT-Doan KT-Doan deleted the feat/oauth2-custom-client-id branch March 17, 2026 07:03
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.

Support specifying client id as part of oauth2 client resource

3 participants