Skip to content

Conversation

Nachwahl
Copy link
Contributor

@Nachwahl Nachwahl commented Jun 25, 2025

Important

Add Twitch as a new OAuth provider, updating backend logic and UI components to support Twitch authentication.

  • Behavior:
    • Add TwitchProvider class in providers/twitch.tsx to handle OAuth with Twitch, including user info post-processing.
    • Update _providers in index.tsx to include TwitchProvider.
    • Add TWITCH to StandardOAuthProviderType enum in schema.prisma.
  • UI Components:
    • Add Twitch icon and color in brand-icons.tsx and BRAND_COLORS.
    • Update ProviderIcon, ProviderSettingDialog, and OAuthButton to support Twitch in providers.tsx and oauth-button.tsx.
  • Misc:
    • Add twitch to standardProviders in oauth.tsx.

This description was created by Ellipsis for 08c0de5. You can customize this summary. It will automatically update as commits are pushed.

@CLAassistant
Copy link

CLAassistant commented Jun 25, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

vercel bot commented Jun 25, 2025

@Nachwahl is attempting to deploy a commit to the Stack Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

recurseml bot commented Jun 25, 2025

⚠️ Only 5 files will be analyzed due to processing limits.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Added Twitch OAuth provider integration across the stack with UI components and backend support.

  • Potential security concern in apps/backend/src/oauth/providers/twitch.tsx needs attention for proper error handling and data validation
  • Uses Plain Object for response handling in Twitch provider instead of Map, consider using Map to prevent prototype pollution (see postProcessUserInfo method)
  • New Twitch provider follows consistent pattern with existing OAuth providers but needs additional validation
  • Added brand-consistent purple (#9146FF) Twitch icon implementation in packages/stack-ui/src/components/brand-icons.tsx
  • Standardized OAuth provider type with 'TWITCH' enum in Prisma schema for database consistency

7 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

Copy link

recurseml bot commented Jun 25, 2025

😱 Found 3 issues. Time to roll up your sleeves! 😱

🗒️ View all ignored comments in this repo
  • The constraint 'TokenStoreType extends string' is too restrictive. It should likely be 'TokenStoreType extends string | object' to match the condition check in line 113 where TokenStoreType is checked against {}
  • Return type mismatch - the interface declares useUsers() returning ServerUser[] but the Team interface that this extends declares useUsers() returning TeamUser[]
  • There is a syntax error in the super constructor call due to the ellipsis operator used incorrectly. Objects aren't being merged correctly. This syntax usage can lead to runtime errors when trying to pass the merged object to 'super()'. Verify that the intended alterations to the object occur before or outside of the super() call if needed.
  • Throwing an error when no active span is found is too aggressive. The log function should gracefully fallback to console.log or another logging mechanism when there's no active span, since not all execution contexts will have an active span. This makes the code less resilient and could break functionality in non-traced environments.

📚 Relevant Docs

  • Function sets backendContext with a new configuration but doesn't pass 'defaultProjectKeys'. Since defaultProjectKeys is required in the type definition and cannot be updated (throws error if tried to set), this will cause a type error.
  • The schema is using array syntax for pick() which is incorrect for Yup schemas. The pick() method in Yup expects individual arguments, not an array. Should be changed to: emailConfigSchema.pick('type', 'host', 'port', 'username', 'sender_name', 'sender_email')

📚 Relevant Docs

  • Creating a refresh token with current timestamp as expiration means it expires immediately. Should set a future date for token expiration.
  • The 'tools' object is initialized as an empty object, even though 'tools' is presumably expected to contain tool definitions. This could cause the server capabilities to lack necessary tool configurations, thus potentially impacting functionalities that depend on certain tool setups.

📚 Relevant Docs

  • 'STACK_SECRET_SERVER_KEY' is potentially being included in every request header without checking its existence again here. Although it's checked during initialization, this could lead to security issues as it's exposed in all communications where the header is logged or captured.

📚 Relevant Docs

  • When adding 'use client' directive at the beginning, it doesn't check if file.text already contains the 'use client' directive. This could lead to duplicate 'use client' directives if the file already has one.

📚 Relevant Docs

Need help? Join our Discord for support!
https://discord.gg/NCpkJ4kF

Copy link

patched-codes bot commented Jun 25, 2025

oauth-button.mdx

  1. Update the provider prop description to include 'twitch' as an example:
    • Current: "The name of the OAuth provider (e.g., 'google', 'github', 'facebook')"
    • Suggested: "The name of the OAuth provider (e.g., 'google', 'github', 'facebook', 'twitch')"

This change is required to reflect the addition of Twitch as a new OAuth provider in the OAuthButton component.

Please ensure these changes are made in the documentation to keep it consistent with the recent updates.

@fomalhautb
Copy link
Contributor

Can you give me permission to edit this PR?

@fomalhautb fomalhautb assigned Nachwahl and unassigned fomalhautb Jul 2, 2025
@Nachwahl
Copy link
Contributor Author

Nachwahl commented Jul 4, 2025

Can you give me permission to edit this PR?

Sure! Do you need permission to our respository?

@fomalhautb
Copy link
Contributor

Can you give me permission to edit this PR?

Sure! Do you need permission to our respository?

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork

@Nachwahl
Copy link
Contributor Author

Nachwahl commented Jul 9, 2025

Can you give me permission to edit this PR?

Sure! Do you need permission to our respository?

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork

Done 👍

Copy link

vercel bot commented Jul 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stack-backend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2025 0:31am
stack-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2025 0:31am
stack-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2025 0:31am
stack-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2025 0:31am

@fomalhautb fomalhautb enabled auto-merge (squash) July 23, 2025 00:25
@fomalhautb fomalhautb merged commit 6a58bb0 into stack-auth:dev Jul 23, 2025
16 checks passed
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.

3 participants