Feature: Netsuite oauth provider
Adds a new custom oauth provider for netsuite
[!IMPORTANT] Introduces NetSuite as a new OAuth provider, updating relevant schemas and configurations to support it.
- Behavior:
- Adds
NetSuiteProviderclass innetsuite.tsxto handle OAuth with NetSuite, including token fetching and user info processing.- Updates
getProvider()inindex.tsxto supportnetsuiteas a provider type.- Adds
netsuiteAccountIdhandling increateOrUpdateProjectWithLegacyConfig()inprojects.tsx.- Schemas:
- Adds
netsuiteAccountIdtoenvironmentConfigSchemainschema.ts.- Updates
oauthProviderReadSchemaandoauthProviderWriteSchemainprojects.tsto includenetsuite_account_id.- Adds
oauthNetSuiteAccountIdSchemainschema-fields.ts.- Misc:
- Adds
netsuitetostandardProvidersinoauth.tsx.This description was created by
for 47025b53143775b5cd620bf2f7206e536afbdeb6. You can customize this summary. It will automatically update as commits are pushed.
Review by RecurseML
๐ Review performed on 5da45d8..47025b5
| Severity | Location | Issue | Action |
|---|---|---|---|
| packages/stack-shared/src/config/schema.ts:205 | Naming inconsistency between schema property and API interface | ||
| packages/stack-shared/src/interface/crud/projects.ts:25 | Object property using snake_case instead of camelCase in TypeScript code |
โ Files analyzed, no issues (3)
โข apps/backend/src/oauth/providers/netsuite.tsx
โข apps/backend/src/oauth/index.tsx
โข apps/backend/src/lib/projects.tsx
โญ๏ธ Files skipped (trigger manually) (2)
| Locations | Trigger Analysis |
|---|---|
packages/stack-shared/src/schema-fields.ts |
|
packages/stack-shared/src/utils/oauth.tsx |
Summary by CodeRabbit
-
New Features
- NetSuite added as a supported OAuth provider for sign-in, including token validation and user profile retrieval.
- Dashboard: NetSuite provider option with an "Account ID" field and NetSuite branding (icon, title, color).
-
Chores
- NetSuite added to the standard provider list.
- Configuration schemas, interfaces, and defaults updated to accept and validate a NetSuite Account ID.
-
Tests
- Updated tests to include NetSuite in allowed OAuth provider types.
@sicarius97 is attempting to deploy a commit to the Stack Team on Vercel.
A member of the Team first needs to authorize it.
[!NOTE]
Other AI code review bot(s) detected
CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.
Walkthrough
Adds NetSuite OAuth support across backend, shared schemas/types, dashboard UI, branding, and templates: new NetSuiteProvider, registration and payload wiring (netsuiteAccountId), schema and CRUD additions, UI form field and icon/color assets.
Changes
| Cohort / File(s) | Summary |
|---|---|
NetSuite OAuth provider implementationapps/backend/src/oauth/providers/netsuite.tsx |
New NetSuiteProvider extending OAuthBaseProvider with create, postProcessUserInfo, and checkAccessTokenValidity; configures NetSuite endpoints/scopes, reads accountId from options or env, normalizes userinfo, and validates tokens. |
Backend registration & project wiringapps/backend/src/oauth/index.tsx, apps/backend/src/lib/projects.tsx |
Registers "netsuite" in provider map; includes netsuiteAccountId in payload for standard provider creation; maps environment auth.oauth.providers.netsuiteAccountId to netsuite_account_id in project create/update. |
Shared schemas, types & utilspackages/stack-shared/src/schema-fields.ts, packages/stack-shared/src/config/schema.ts, packages/stack-shared/src/interface/crud/projects.ts, packages/stack-shared/src/utils/oauth.tsx, packages/stack-shared/src/config/schema-fuzzer.test.ts |
Adds oauthNetSuiteAccountIdSchema; exposes netsuiteAccountId on environment OAuth provider schema and org defaults; adds netsuite_account_id to CRUD schema; appends "netsuite" to standardProviders; adds fuzzing example for netsuiteAccountId. |
Dashboard UI changesapps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx |
Adds netsuite title mapping, netsuiteAccountId to provider form schema and defaults, conditional Account ID input for netsuite, and includes netsuiteAccountId in update payload for standard providers. |
Branding & iconspackages/stack-ui/src/components/brand-icons.tsx |
Adds Netsuite SVG component, maps netsuite to the icon/title, and adds netsuite brand color (#403C38). |
Template typespackages/template/src/lib/stack-app/project-configs/index.ts |
Adds optional netsuiteAccountId?: string to AdminOAuthProviderConfig for standard providers. |
Testsapps/e2e/tests/backend/endpoints/api/v1/internal/config.test.ts |
Extends expected allowed provider types literal to include netsuite in a test assertion. |
Sequence Diagram(s)
sequenceDiagram
autonumber
participant Client
participant Backend as Backend OAuth Controller
participant Provider as NetSuiteProvider
participant NetSuite as NetSuite OAuth2
Client->>Backend: Start OAuth (provider=netsuite)
Backend->>Provider: create({ clientId, clientSecret, accountId })
Note right of Provider `#DDEBEF`: Configure issuer, auth/token endpoints, scopes
Backend->>NetSuite: Redirect user to Authorization Endpoint
NetSuite-->>Client: Login & consent
Client->>Backend: Callback with code
Backend->>NetSuite: Token request (code)
NetSuite-->>Backend: TokenSet (access_token, expires)
Backend->>Provider: postProcessUserInfo(TokenSet)
Provider->>NetSuite: GET /userinfo (Bearer)
NetSuite-->>Provider: User info JSON (may include accountId)
Provider-->>Backend: OAuthUserInfo (accountId, email, name)
Backend-->>Client: Session established
sequenceDiagram
autonumber
participant Scheduler as Token Checker
participant Provider as NetSuiteProvider
participant NetSuite as NetSuite OAuth2
Scheduler->>Provider: checkAccessTokenValidity(accessToken)
Provider->>NetSuite: GET /services/rest/.../oauth2/v1/userinfo (Bearer)
alt 200 OK
NetSuite-->>Provider: 200 OK
Provider-->>Scheduler: true
else non-OK / error
NetSuite--x Provider: Error/Non-OK
Provider-->>Scheduler: false
end
Estimated code review effort
๐ฏ 4 (Complex) | โฑ๏ธ ~45 minutes
- Areas needing focused review:
-
apps/backend/src/oauth/providers/netsuite.tsxโ userinfo parsing for multiple response shapes, accountId validation, token expiry handling. - Consistency of
netsuiteAccountId(camelCase) vsnetsuite_account_id(snake_case) across backend mappings, shared schemas, and DB/project wiring. - Dashboard form conditional rendering and payload submission path.
- Schema additions in shared package for backward compatibility and OpenAPI metadata.
-
Possibly related PRs
- stack-auth/stack-auth#835 โ touches
apps/backend/src/lib/projects.tsxand modifiescreateOrUpdateProjectWithLegacyConfig; likely related to wiring changes for provider mapping and payload shape.
Poem
I hop through scopes with gentle might,
I add an Account ID to make things right,
I fetch userinfo by token's light,
I draw a new icon in brand-true sight,
I nibble bugs and ship delight. ๐โจ
Pre-merge checks and finishing touches
โ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
โ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | โ Passed | The title clearly and specifically summarizes the main change: introducing NetSuite as a new OAuth provider. |
| Description check | โ Passed | The description comprehensively covers the changes with clear sections on behavior, schemas, and misc updates, explaining the scope and rationale of the PR. |
โจ Finishing touches
- [ ] ๐ Generate docstrings
๐งช Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
๐ Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ฅ Commits
Reviewing files that changed from the base of the PR and between c1694938487ebee9d04bc40c877c9ad83f31c8ad and 0d05ba44c8f1b18c013294aa82033fd18adcb4f4.
๐ Files selected for processing (1)
-
apps/e2e/tests/backend/endpoints/api/v1/internal/config.test.ts(1 hunks)
โ Files skipped from review due to trivial changes (1)
- apps/e2e/tests/backend/endpoints/api/v1/internal/config.test.ts
โฐ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Vercel Agent Review
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| stack-backend | Preview | Comment | Nov 14, 2025 11:56pm | |
| stack-dashboard | Preview | Comment | Nov 14, 2025 11:56pm | |
| stack-demo | Preview | Comment | Nov 14, 2025 11:56pm | |
| stack-docs | Preview | Comment | Nov 14, 2025 11:56pm |