-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add pseudoidc-starter sample #473
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?
Conversation
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.
Pull Request Overview
This PR adds a new pseudoidc-starter sample application featuring authentication using both email magic links and ConsentKeys OIDC provider integration. The sample provides a complete Next.js authentication starter kit with BetterAuth, demonstrating how to implement dual authentication methods in a production-ready application.
- Email magic link authentication flow with nodemailer integration
- ConsentKeys OIDC provider authentication with detailed debugging
- Complete Next.js application structure with protected routes and authentication UI
Reviewed Changes
Copilot reviewed 29 out of 37 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Standard Next.js TypeScript configuration with path aliases |
| src/lib/db/schema.ts | Database schema for user, session, account, and verification tables |
| src/lib/db/index.ts | Database connection setup using Drizzle ORM with PostgreSQL |
| src/lib/auth/authClient.ts | Frontend auth client configuration with magic link and OAuth plugins |
| src/lib/auth/auth.ts | Main BetterAuth server configuration with nodemailer and OIDC setup |
| src/lib/auth.ts | Minimal auth configuration file |
| src/components/layout/sign-out-button.tsx | Reusable sign-out button component |
| src/components/forms/login-form.tsx | Complete login form with magic link and OAuth options |
| src/app/protected/page.tsx | Protected route example with session validation |
| src/app/page.tsx | Home page with authentication-based routing |
| src/app/login/page.tsx | Login page layout and session redirect |
| src/app/layout.tsx | Root layout with font setup |
| src/app/globals.css | Global styles with Tailwind CSS |
| src/app/api/auth/email/route.ts | API route for handling magic link requests |
| src/app/api/auth/[...auth]/route.ts | BetterAuth API route handler |
| package.json | Project dependencies and scripts for development |
| drizzle files | Database migration files and configuration |
| Documentation | README and setup guides for the sample |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| }); | ||
| if (session) { | ||
| redirect('/protected'); | ||
| }else{ |
Copilot
AI
Sep 22, 2025
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.
Add a space after 'else' for consistent formatting: } else {
| }else{ | |
| } else { |
| import { redirect } from 'next/navigation' | ||
| import { useState } from 'react'; | ||
|
|
||
| const SignOutButton = () => { | ||
|
|
||
| const [isLoading, setIsLoading] = useState(false); | ||
|
|
||
| const handleSignOut = async () => { | ||
| setIsLoading(true); | ||
| await signOut(); | ||
| setIsLoading(false); | ||
| redirect('/login'); |
Copilot
AI
Sep 22, 2025
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.
The redirect function cannot be used in client components. It should be used in Server Components or Server Actions. Consider using router.push() from next/navigation instead, or handle the redirect after successful sign-out.
| import { redirect } from 'next/navigation' | |
| import { useState } from 'react'; | |
| const SignOutButton = () => { | |
| const [isLoading, setIsLoading] = useState(false); | |
| const handleSignOut = async () => { | |
| setIsLoading(true); | |
| await signOut(); | |
| setIsLoading(false); | |
| redirect('/login'); | |
| import { useRouter } from 'next/navigation' | |
| import { useState } from 'react'; | |
| const SignOutButton = () => { | |
| const [isLoading, setIsLoading] = useState(false); | |
| const router = useRouter(); | |
| const handleSignOut = async () => { | |
| setIsLoading(true); | |
| await signOut(); | |
| setIsLoading(false); | |
| router.push('/login'); |
| import { betterAuth } from "better-auth" | ||
|
|
||
| export const auth = betterAuth({ | ||
| // Basic configuration | ||
| }) | ||
|
|
||
| export const { handler, api } = auth No newline at end of file |
Copilot
AI
Sep 22, 2025
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.
This file appears to be unused as the main auth configuration is in src/lib/auth/auth.ts. Consider removing this file to avoid confusion or clearly document its purpose if it's intended for a different use case.
| import { betterAuth } from "better-auth" | |
| export const auth = betterAuth({ | |
| // Basic configuration | |
| }) | |
| export const { handler, api } = auth |
Samples Checklist
✅ All good!