-
Notifications
You must be signed in to change notification settings - Fork 428
OAuth provider crud #759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth provider crud #759
Conversation
- Removed the user_id and provider_id parameters from the onCreate method, replacing them with a single data object. - Updated error messages to reflect changes in parameter names. - Added a new schema for provider_config_id to validate incoming requests. - Deleted unused route file for user-specific OAuth provider retrieval. - Adjusted tests to align with the new API structure and ensure proper validation.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✨ No issues found! Your code is sparkling clean! ✨ 🗒️ View all ignored comments in this repo
Need help? Join our Discord for support! |
…stack into oauth-provider-curd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements a significant refactoring of the OAuth provider system in stack-auth. The key changes include:
- Restructuring OAuth account relationships by merging ConnectedAccount functionality into ProjectUserOAuthAccount
- Adding explicit
allowSignIn
andallowConnectedAccounts
flags to control OAuth account usage - Introducing a new
provider_config_id
field for more flexible OAuth provider configuration management - Adding comprehensive CRUD operations for OAuth providers with proper validation and access controls
- Improving token storage and management by tying tokens directly to OAuth accounts
The changes enable more flexible OAuth provider management while maintaining data integrity and security. The new structure allows OAuth accounts to exist independently of users (optional projectUserId) and provides better control over how OAuth accounts can be used for authentication or as connected accounts.
Confidence score: 3/5
- This PR introduces significant structural changes to OAuth handling that should be carefully tested
- While the implementation is thorough, the complexity of OAuth-related changes and the broad scope of the refactoring introduces risks
- The following files need particular attention:
- apps/backend/prisma/migrations/20250711232750_oauth_method/migration.sql (complex data migration)
- apps/backend/src/app/api/latest/auth/oauth/callback/[provider_id]/route.tsx (critical auth flow changes)
- apps/backend/src/app/api/latest/oauth-providers/crud.tsx (new validation logic)
22 files reviewed, 5 comments
Edit PR Review Bot Settings | Greptile
apps/backend/src/app/api/latest/oauth-providers/[user_id]/[provider_id]/route.tsx
Show resolved
Hide resolved
apps/backend/src/app/api/latest/auth/oauth/callback/[provider_id]/route.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! it's very satisfying to see how many of the edge cases are handled
Important
Add CRUD operations for OAuth providers, update schemas and error handling, and include tests for new functionality.
client-interface.ts
andserver-interface.ts
.oauthProviderCrud
inoauth-providers.ts
for managing OAuth provider data.schema-fields.ts
to include new schemas for OAuth provider attributes.known-errors.tsx
.oauthProviderCrudClientUpdateSchema
,oauthProviderCrudServerUpdateSchema
, andoauthProviderCrudServerCreateSchema
inoauth-providers.ts
.projects.ts
to includeoauthProviderReadSchema
andoauthProviderWriteSchema
.oauth-providers.test.ts
.oauth.ts
toconnected-accounts.ts
incrud
directory.projects.test.ts
to includeprovider_config_id
in OAuth provider configurations.This description was created by
for bca9bcf. You can customize this summary. It will automatically update as commits are pushed.
Important
Add CRUD operations for OAuth providers, update schemas, handle errors, and include tests.
client-interface.ts
andserver-interface.ts
.oauthProviderCrud
inoauth-providers.ts
for managing OAuth provider data.schema-fields.ts
to include new schemas for OAuth provider attributes.known-errors.tsx
.oauthProviderCrudClientUpdateSchema
,oauthProviderCrudServerUpdateSchema
, andoauthProviderCrudServerCreateSchema
inoauth-providers.ts
.projects.ts
to includeoauthProviderReadSchema
andoauthProviderWriteSchema
.oauth-providers.test.ts
.oauth.ts
toconnected-accounts.ts
incrud
directory.projects.test.ts
to includeprovider_config_id
in OAuth provider configurations.This description was created by
for aaa55f7. You can customize this summary. It will automatically update as commits are pushed.