Skip to content

Conversation

@tjb9dc
Copy link
Collaborator

@tjb9dc tjb9dc commented Dec 8, 2025

Description

Refs #11029

Implements OAuth token override support for the Go SDK generator, mirroring the feature from the TypeScript generator PR #11029. When enabled via the oauthTokenOverride config option, users can provide a pre-generated bearer token directly via the WithToken option function, bypassing the OAuth client credentials flow.

Link to Devin run: https://app.devin.ai/sessions/f7ea32bafbe64688bced47359d9fb67c
Requested by: [email protected] (@tjb9dc)

Changes Made

  • Added oauthTokenOverride to Go v2 custom config schema (BaseGoCustomConfigSchema.ts)
  • Added OAuthTokenOverride field to Go v1 custom config and generator Config structs
  • Implemented OAuth token override in Go v1 generator (sdk.go):
    • Adds Token string field to RequestOptions struct when OAuth auth scheme is present and config is enabled
    • Adds WithToken option function for setting the token
    • Adds logic in ToHeader() to set Authorization: Bearer <token> header
  • Updated all Go generator entry points (fern-go-sdk, fern-go-model, fern-go-fiber) to pass the new parameter
  • Updated versions.yml with changelog entry for v1.19.0

Updates Since Last Revision

  • Fixed CI build failure by adding OAuthTokenOverride parameter to NewConfig calls in fern-go-model/main.go and fern-go-fiber/main.go (the parameter is passed through but not used by these generators)

Testing

  • TypeScript lint checks passed (pnpm run check)
  • Go compilation verification (Go not installed in environment - relying on CI)
  • Seed tests for Go SDK

Human Review Checklist

  • Verify Go code compiles correctly (CI should confirm this)
  • Verify generated code produces correct WithToken option when oauthTokenOverride: true is configured
  • Consider adding/updating seed tests for OAuth token override feature
  • Note: Go v2 generator has OAuth marked as TODO - only config option was added, no implementation

Add support for OAuth token override via the oauthTokenOverride config option.
When enabled, users can provide a pre-generated bearer token directly via the
WithToken option function, bypassing the OAuth client credentials flow.

Changes:
- Add oauthTokenOverride to Go custom config schema (v2)
- Add OAuthTokenOverride to Go v1 custom config and generator Config
- Implement OAuth token override in Go v1 generator (sdk.go)
- Update versions.yml with changelog entry for v1.19.0

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

…o-fiber

Add the missing OAuthTokenOverride parameter to the NewConfig calls in
fern-go-model and fern-go-fiber main.go files to fix the build error.

Co-Authored-By: [email protected] <[email protected]>
@tjb9dc tjb9dc closed this Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants