Skip to content

Update login providers list - #49

Merged
ingoau merged 6 commits into
mainfrom
update-login-providers-list
May 12, 2026
Merged

ingoau merged 6 commits into
mainfrom
update-login-providers-list

Conversation

@ingoau

@ingoau ingoau commented May 12, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Expanded OAuth authentication options. Users can now sign in via Hack Club, GitHub, or Google instead of a single provider choice.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@ingoau has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 7 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8bc60878-3fa4-4957-a1a7-db61f2bf57fa

📥 Commits

Reviewing files that changed from the base of the PR and between a1b121a and 08302fa.

📒 Files selected for processing (4)
  • src/lib/auth/providers.ts
  • src/lib/components/login.svelte
  • src/lib/components/organizer/sidebar/account-dialog.svelte
  • src/lib/components/ui/sidebar/sidebar-trigger.svelte
📝 Walkthrough

Walkthrough

This PR adds support for multiple OAuth providers in the authentication flow. It introduces a new OAuth provider configuration, refactors the login UI to dynamically render provider buttons instead of a single hardcoded button, and updates the auth client import path across multiple components as part of module restructuring.

Changes

OAuth Provider Configuration and Multi-Provider Login

Layer / File(s) Summary
OAuth provider schema and type definition
src/lib/auth/providers.ts
A new oauthProviders constant array defines three OAuth providers (Hack Club, GitHub, Google) with id and label fields; a derived OAuthProviderId type restricts IDs to the literal string union from those providers.
Dynamic OAuth UI in login component
src/lib/components/login.svelte
Login component imports oauthProviders and the updated auth client path, then replaces the hardcoded "Continue with Hack Club" button with a dynamically rendered button list; each button calls authClient.signIn.oauth2 with the provider ID and handles errors by clearing loading and showing a toast.
Auth client module import path migration
src/lib/components/organizer/sidebar/account-dialog.svelte, src/lib/components/organizer/sidebar/user.svelte, src/routes/+layout.svelte
authClient import paths are updated from '$lib/auth-client' to '$lib/auth/client' across three component files to align with the auth module directory restructuring.

Sequence Diagram

sequenceDiagram
  participant User
  participant LoginUI
  participant oauthProviders
  participant authClient
  participant CallbackURL

  User->>LoginUI: Click OAuth button for provider
  LoginUI->>oauthProviders: Get provider.id
  LoginUI->>authClient: signIn.oauth2(provider.id, callbackURL)
  alt OAuth success
    authClient->>CallbackURL: Redirect with auth token
  else OAuth error
    authClient->>LoginUI: Return error response
    LoginUI->>User: Show error toast, clear loading
  end
Loading

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Three OAuth paths now dance with glee,
Where once stood one, now all can be—
Hack Club, GitHub, Google too,
Dynamic buttons fresh and new,
Login's got a makeover true! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a new oauthProviders list with multiple login providers and making the login component use it dynamically.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-login-providers-list

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/components/organizer/sidebar/account-dialog.svelte (1)

90-94: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Deduplicate provider configuration.

Now that oauthProviders is centralized in src/lib/auth/providers.ts, this local providerConfigs array duplicates the same provider list. Import and use oauthProviders instead to maintain a single source of truth.

♻️ Proposed refactor to eliminate duplication

Add the import at the top of the script:

 	import { UAParser } from 'ua-parser-js';
 	import { cn } from '$lib/utils';
+	import { oauthProviders } from '$lib/auth/providers';

Then replace the local array:

-	const providerConfigs = [
-		{ id: 'hca', label: 'Hack Club' },
-		{ id: 'github', label: 'GitHub' },
-		{ id: 'google', label: 'Google' }
-	] as const;
+	const providerConfigs = oauthProviders;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/components/organizer/sidebar/account-dialog.svelte` around lines 90 -
94, The local providerConfigs array duplicates the centralized oauthProviders
list; remove the local const and import oauthProviders from
src/lib/auth/providers (use the identifier oauthProviders) at the top of
account-dialog.svelte, then replace uses of providerConfigs with oauthProviders
so the component consumes the single source of truth (ensure any type assertions
or "as const" needs are satisfied by oauthProviders).
🧹 Nitpick comments (1)
src/lib/components/login.svelte (1)

56-81: 💤 Low value

Dynamic OAuth provider rendering looks good.

The refactor from a hardcoded button to dynamic rendering from oauthProviders is clean and maintains proper error handling. The loading state is correctly managed on both success and error paths.

Consider surfacing more specific error messages when available:

💡 Optional: More helpful error messages
 							const { error } = await authClient.signIn.oauth2({
 								providerId: provider.id,
 								callbackURL: '/organizer'
 							});
 							if (error) {
 								loading = false;
-								toast.error('Something went wrong');
+								toast.error(error.message ?? 'Something went wrong');
 							}
 						} catch {
 							loading = false;
 							toast.error('Something went wrong');
 						}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/components/login.svelte` around lines 56 - 81, Replace the generic
toast messages with the actual error text when available: in the oauth button
click handler around authClient.signIn.oauth2 (referencing oauthProviders,
authClient.signIn.oauth2, loading, and toast.error), change the if (error)
branch to call toast.error(error.message || 'Something went wrong') and in the
catch block use catch (err) { loading = false; toast.error(err?.message ||
'Something went wrong') } so any returned or thrown error message is surfaced to
the user while still falling back to the generic message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/lib/components/organizer/sidebar/account-dialog.svelte`:
- Around line 90-94: The local providerConfigs array duplicates the centralized
oauthProviders list; remove the local const and import oauthProviders from
src/lib/auth/providers (use the identifier oauthProviders) at the top of
account-dialog.svelte, then replace uses of providerConfigs with oauthProviders
so the component consumes the single source of truth (ensure any type assertions
or "as const" needs are satisfied by oauthProviders).

---

Nitpick comments:
In `@src/lib/components/login.svelte`:
- Around line 56-81: Replace the generic toast messages with the actual error
text when available: in the oauth button click handler around
authClient.signIn.oauth2 (referencing oauthProviders, authClient.signIn.oauth2,
loading, and toast.error), change the if (error) branch to call
toast.error(error.message || 'Something went wrong') and in the catch block use
catch (err) { loading = false; toast.error(err?.message || 'Something went
wrong') } so any returned or thrown error message is surfaced to the user while
still falling back to the generic message.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 76453a25-b1d2-4710-abc1-bfcd48bc4a75

📥 Commits

Reviewing files that changed from the base of the PR and between ed78e6a and a1b121a.

📒 Files selected for processing (6)
  • src/lib/auth/client.ts
  • src/lib/auth/providers.ts
  • src/lib/components/login.svelte
  • src/lib/components/organizer/sidebar/account-dialog.svelte
  • src/lib/components/organizer/sidebar/user.svelte
  • src/routes/+layout.svelte

@ingoau
ingoau merged commit 03e69f5 into main May 12, 2026
7 checks passed
@ingoau
ingoau deleted the update-login-providers-list branch May 12, 2026 05:12
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.

1 participant