-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add generic OAuth provider #2091
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -174,6 +174,13 @@ export const env = createEnv({ | |||||||||||||
| GOOGLE_CLIENT_SECRET: z.string().optional(), // Google OAuth client secret | ||||||||||||||
| GITHUB_CLIENT_ID: z.string().optional(), // GitHub OAuth client ID for GitHub integration | ||||||||||||||
| GITHUB_CLIENT_SECRET: z.string().optional(), // GitHub OAuth client secret | ||||||||||||||
| OAUTH_CLIENT_ID: z.string().optional(), // OAuth client ID | ||||||||||||||
| OAUTH_CLIENT_SECRET: z.string().optional(), // OAuth client secret | ||||||||||||||
| OAUTH_AUTHORIZATION_URL: z.string().optional(), // OAuth authorization URL | ||||||||||||||
| OAUTH_TOKEN_URL: z.string().optional(), // OAuth token URL | ||||||||||||||
| OAUTH_USERINFO_URL: z.string().optional(), // OAuth userinfo URL | ||||||||||||||
|
Comment on lines
+179
to
+181
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: missing URL validation - use Other URL fields in this file use
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/sim/lib/env.ts
Line: 179:181
Comment:
**style:** missing URL validation - use `.url()` validator like other URL fields
Other URL fields in this file use `.url()` validation (e.g., `DATABASE_URL: z.string().url()` on line 19, `OLLAMA_URL: z.string().url().optional()` on line 79). This validates URL format and prevents configuration errors.
```suggestion
OAUTH_AUTHORIZATION_URL: z.string().url().optional(), // OAuth authorization URL
OAUTH_TOKEN_URL: z.string().url().optional(), // OAuth token URL
OAUTH_USERINFO_URL: z.string().url().optional(), // OAuth userinfo URL
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||
| OAUTH_SCOPES: z.string().optional(), // OAuth scopes | ||||||||||||||
| OAUTH_PROVIDER_ID: z.string().optional(), // OAuth provider ID | ||||||||||||||
| GITHUB_REPO_CLIENT_ID: z.string().optional(), // GitHub OAuth client ID for repo access | ||||||||||||||
| GITHUB_REPO_CLIENT_SECRET: z.string().optional(), // GitHub OAuth client secret for repo access | ||||||||||||||
| X_CLIENT_ID: z.string().optional(), // X (Twitter) OAuth client ID | ||||||||||||||
|
|
||||||||||||||
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.
logic: missing
getUserInfofunction - this will cause authentication to failAll other genericOAuth providers in this file (github-repo, wealthbox, pipedrive, hubspot, salesforce, supabase, x, webflow) include a
getUserInfofunction that fetches user data from the provider and returns it in Better Auth's expected format.The generic OAuth configuration needs a
getUserInfoasync function that:OAUTH_USERINFO_URLusing the access tokenSee
apps/sim/lib/auth.ts:833-868(Salesforce) for a standard OIDC implementation pattern.Prompt To Fix With AI