-
Notifications
You must be signed in to change notification settings - Fork 143
feat: add expo plugin and trusted origins #597
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
base: v3-main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes add the Changes
Sequence Diagram(s)sequenceDiagram
participant Client (Expo App)
participant Server (auth.tsx)
participant BetterAuth
participant ExpoPlugin
Client (Expo App)->>Server (auth.tsx): Initiate authentication request
Server (auth.tsx)->>BetterAuth: Process authentication with plugins
BetterAuth->>ExpoPlugin: Use Expo plugin for authentication flow
ExpoPlugin-->>BetterAuth: Return authentication result
BetterAuth-->>Server (auth.tsx): Return auth result (with trusted origin check)
Server (auth.tsx)-->>Client (Expo App): Respond with authentication outcome
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
app/server/auth.tsx
(3 hunks)package.json
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
app/server/auth.tsx (1)
Learnt from: ivan-dalmet
PR: BearStudio/start-ui-web#532
File: src/server/config/oauth/providers/discord.ts:11-11
Timestamp: 2024-10-14T15:29:53.279Z
Learning: In `src/server/config/oauth/providers/discord.ts`, when defining the `zDiscordUser` schema, keep fields like `username` as nullable (e.g., `.nullish()`), as the Discord API might return null values despite the documentation stating otherwise.
🧬 Code Graph Analysis (1)
app/server/auth.tsx (1)
app/env/server.ts (1)
envServer
(9-33)
🪛 ESLint
app/server/auth.tsx
[error] 21-21: 'inferAdditionalFields' is defined but never used. Allowed unused vars must match /^_/u.
(@typescript-eslint/no-unused-vars)
[error] 21-21: Remove this unused import of 'inferAdditionalFields'.
(sonarjs/unused-import)
🔇 Additional comments (4)
package.json (1)
47-47
: LGTM - Dependency addition looks correct.The
@better-auth/expo
dependency is properly added and the version aligns well with the existingbetter-auth
ecosystem in the project.app/server/auth.tsx (3)
5-5
: LGTM - Expo plugin import correctly added.The import is properly used in the plugins array configuration.
29-29
: LGTM - Trusted origins configuration is appropriate.The trusted origins configuration with
start-ui-native://
andstart-ui-native://*
properly allows the native Expo app to authenticate with the web server. This follows the expected pattern for Expo deep linking authentication flows.
54-54
: LGTM - Expo plugin correctly integrated.The
expo()
plugin is properly added to the plugins array and will enable Expo-specific authentication functionality.
app/server/auth.tsx
Outdated
@@ -17,13 +18,15 @@ import { permissions } from '@/features/auth/permissions'; | |||
import { db } from '@/server/db'; | |||
import { sendEmail } from '@/server/email'; | |||
import { getUserLanguage } from '@/server/utils'; | |||
import { inferAdditionalFields } from 'better-auth/client/plugins'; |
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.
Remove unused import.
The inferAdditionalFields
import is not used anywhere in the code and should be removed to keep the codebase clean.
-import { inferAdditionalFields } from 'better-auth/client/plugins';
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { inferAdditionalFields } from 'better-auth/client/plugins'; |
🧰 Tools
🪛 ESLint
[error] 21-21: 'inferAdditionalFields' is defined but never used. Allowed unused vars must match /^_/u.
(@typescript-eslint/no-unused-vars)
[error] 21-21: Remove this unused import of 'inferAdditionalFields'.
(sonarjs/unused-import)
🤖 Prompt for AI Agents
In app/server/auth.tsx at line 21, the import statement for
inferAdditionalFields from better-auth/client/plugins is unused. Remove this
import line entirely to clean up the code and avoid unnecessary imports.
123ca57
to
ccdf949
Compare
@@ -24,6 +25,7 @@ export const auth = betterAuth({ | |||
expiresIn: envServer.SESSION_EXPIRATION_IN_SECONDS, | |||
updateAge: envServer.SESSION_UPDATE_AGE_IN_SECONDS, | |||
}, | |||
trustedOrigins: ['start-ui-native://', 'start-ui-native://*'], |
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.
Is it possible to put that in environment variable or something like that?
Because client and side-project apps won't use those values.
8776fa0
to
3e9f56d
Compare
|
cf02ee7
to
cbaf95e
Compare
Describe your changes
Add expo plugin and trusted origins to
better-auth
config, to make socials login works on start ui native using start ui web serverSummary by CodeRabbit
New Features
Chores