Skip to content

Feat/GitHub login#39

Open
RafaDSan wants to merge 8 commits intoheronlancellot:devfrom
RafaDSan:feat/github-login
Open

Feat/GitHub login#39
RafaDSan wants to merge 8 commits intoheronlancellot:devfrom
RafaDSan:feat/github-login

Conversation

@RafaDSan
Copy link
Collaborator

No description provided.

@RafaDSan RafaDSan requested a review from Copilot October 25, 2025 20:55
@vercel
Copy link
Contributor

vercel bot commented Oct 25, 2025

@RafaDSan is attempting to deploy a commit to the Heron Lancellot's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements GitHub OAuth authentication using Supabase, replacing the previous simulated authentication flow with a real OAuth integration.

Key Changes:

  • Integrated Supabase SSR for server-side authentication handling with PKCE flow
  • Implemented real GitHub OAuth login flow with proper session management
  • Added middleware for authentication state management and route protection

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
frontend/src/middleware.ts Added Next.js middleware to handle session updates on all routes
frontend/src/integrations/supabase/server.ts Created server-side Supabase client for authentication operations
frontend/src/integrations/supabase/middleware.ts Implemented session update logic and unauthenticated user redirection
frontend/src/integrations/supabase/client.ts Migrated from createClient to createBrowserClient with PKCE flow
frontend/src/components/login-form.tsx Updated login form to use real GitHub OAuth with loading states
frontend/src/app/auth/callback/page.tsx Converted to server component to handle OAuth code exchange
frontend/package.json Added @supabase/ssr dependency
Files not reviewed (1)
  • frontend/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,10 @@
import { type NextRequest } from 'next/server';
import { updateSession } from '@/integrations/supabase/middleware'
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

Missing semicolon at the end of the import statement.

Suggested change
import { updateSession } from '@/integrations/supabase/middleware'
import { updateSession } from '@/integrations/supabase/middleware';

Copilot uses AI. Check for mistakes.
cookiesToSet.forEach(({ name, value, options }) =>
cookieStore.set(name, value, options)
);
} catch {
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

Empty catch block silently swallows all errors. At minimum, log the error or add a comment explaining why errors can be safely ignored in this context.

Suggested change
} catch {
} catch (error) {
console.error("Error setting cookies in setAll:", error);

Copilot uses AI. Check for mistakes.
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: true,
// import { supabase } from ":/integrations/supabase/client";
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

Corrected malformed import path prefix from ':' to '@'.

Suggested change
// import { supabase } from ":/integrations/supabase/client";
// import { supabase } from "@/integrations/supabase/client";

Copilot uses AI. Check for mistakes.
const { error } = await supabase.auth.signInWithOAuth({
provider: "github",
options: {
redirectTo: "http://localhost:3000/auth/callback",
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

Hardcoded localhost URL should use the getURL() helper function defined above (lines 19-27) to support different environments.

Suggested change
redirectTo: "http://localhost:3000/auth/callback",
redirectTo: getURL(),

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +20
redirect("/login?error=Invalid_callback_request");

useEffect(() => {
// Simulate auth processing
const timer = setTimeout(() => {
router.push("/onboarding");
}, 2000);
return null;
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

Unreachable code: the return null; statement on line 20 will never execute because redirect() throws and transfers control.

Copilot uses AI. Check for mistakes.
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

Comments