Jacksuyu commited on
Commit
59baa12
·
1 Parent(s): d438808

Simplify auth to Google-only provider

Browse files
Files changed (5) hide show
  1. .env.example +0 -6
  2. Dockerfile +0 -6
  3. README.md +2 -5
  4. app/login/page.tsx +15 -27
  5. auth.ts +9 -40
.env.example CHANGED
@@ -5,9 +5,3 @@ OPENAI_MODEL="gpt-4.1-mini"
5
  AUTH_SECRET="replace-with-long-random-secret"
6
  AUTH_GOOGLE_ID=""
7
  AUTH_GOOGLE_SECRET=""
8
- AUTH_GITHUB_ID=""
9
- AUTH_GITHUB_SECRET=""
10
- AUTH_APPLE_ID=""
11
- AUTH_APPLE_SECRET=""
12
- AUTH_FACEBOOK_ID=""
13
- AUTH_FACEBOOK_SECRET=""
 
5
  AUTH_SECRET="replace-with-long-random-secret"
6
  AUTH_GOOGLE_ID=""
7
  AUTH_GOOGLE_SECRET=""
 
 
 
 
 
 
Dockerfile CHANGED
@@ -17,12 +17,6 @@ ENV OPENAI_MODEL="gpt-4.1-mini"
17
  ENV AUTH_SECRET="change-me-in-production"
18
  ENV AUTH_GOOGLE_ID=""
19
  ENV AUTH_GOOGLE_SECRET=""
20
- ENV AUTH_GITHUB_ID=""
21
- ENV AUTH_GITHUB_SECRET=""
22
- ENV AUTH_APPLE_ID=""
23
- ENV AUTH_APPLE_SECRET=""
24
- ENV AUTH_FACEBOOK_ID=""
25
- ENV AUTH_FACEBOOK_SECRET=""
26
  ENV NODE_ENV=production
27
  ENV PORT=7860
28
 
 
17
  ENV AUTH_SECRET="change-me-in-production"
18
  ENV AUTH_GOOGLE_ID=""
19
  ENV AUTH_GOOGLE_SECRET=""
 
 
 
 
 
 
20
  ENV NODE_ENV=production
21
  ENV PORT=7860
22
 
README.md CHANGED
@@ -23,7 +23,7 @@ Users submit product ideas and the app generates structured specs (features + ta
23
 
24
  ## Features
25
 
26
- - OIDC login support (Google, GitHub, Apple, optional Facebook)
27
  - Anonymous posting by default; logged-in submitters can show visible name
28
  - Developer profiles (display name, headline, bio, links)
29
  - Idea/task work votes: developers signal they are working on specific scope
@@ -58,12 +58,9 @@ Optional LLM:
58
  - `OPENAI_API_KEY`
59
  - `OPENAI_MODEL` (default: `gpt-4.1-mini`)
60
 
61
- OIDC providers (set whichever you want to enable):
62
 
63
  - `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET`
64
- - `AUTH_GITHUB_ID`, `AUTH_GITHUB_SECRET`
65
- - `AUTH_APPLE_ID`, `AUTH_APPLE_SECRET`
66
- - `AUTH_FACEBOOK_ID`, `AUTH_FACEBOOK_SECRET` (optional)
67
 
68
  ## Deploy to Hugging Face Spaces (Docker)
69
 
 
23
 
24
  ## Features
25
 
26
+ - OIDC login support (Google) for now
27
  - Anonymous posting by default; logged-in submitters can show visible name
28
  - Developer profiles (display name, headline, bio, links)
29
  - Idea/task work votes: developers signal they are working on specific scope
 
58
  - `OPENAI_API_KEY`
59
  - `OPENAI_MODEL` (default: `gpt-4.1-mini`)
60
 
61
+ OIDC provider (currently enabled):
62
 
63
  - `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET`
 
 
 
64
 
65
  ## Deploy to Hugging Face Spaces (Docker)
66
 
app/login/page.tsx CHANGED
@@ -1,44 +1,32 @@
1
  import { signIn } from "@/auth";
2
 
3
- const providerConfig = [
4
- { id: "google", label: "Continue with Google", enabled: Boolean(process.env.AUTH_GOOGLE_ID && process.env.AUTH_GOOGLE_SECRET) },
5
- { id: "github", label: "Continue with GitHub", enabled: Boolean(process.env.AUTH_GITHUB_ID && process.env.AUTH_GITHUB_SECRET) },
6
- { id: "apple", label: "Continue with Apple", enabled: Boolean(process.env.AUTH_APPLE_ID && process.env.AUTH_APPLE_SECRET) },
7
- { id: "facebook", label: "Continue with Facebook", enabled: Boolean(process.env.AUTH_FACEBOOK_ID && process.env.AUTH_FACEBOOK_SECRET) },
8
- ];
9
 
10
  export default function LoginPage() {
11
- const enabled = providerConfig.filter((provider) => provider.enabled);
12
-
13
  return (
14
  <div className="mx-auto max-w-xl space-y-5">
15
  <section className="hero-panel reveal-up">
16
- <p className="kicker">OIDC Login</p>
17
  <h1 className="section-title mt-2 text-3xl">Sign in as idea submitter or developer</h1>
18
- <p className="subtle mt-3 text-sm">
19
- Supported providers: Google, GitHub, Apple, and optionally Facebook.
20
- </p>
21
  </section>
22
 
23
  <section className="card space-y-3">
24
- {enabled.length === 0 ? (
25
  <p className="text-sm text-red-700">
26
- No auth providers are configured yet. Add provider env vars to enable login.
27
  </p>
28
  ) : (
29
- enabled.map((provider) => (
30
- <form
31
- key={provider.id}
32
- action={async () => {
33
- "use server";
34
- await signIn(provider.id, { redirectTo: "/" });
35
- }}
36
- >
37
- <button className="btn w-full" type="submit">
38
- {provider.label}
39
- </button>
40
- </form>
41
- ))
42
  )}
43
  </section>
44
  </div>
 
1
  import { signIn } from "@/auth";
2
 
3
+ const googleEnabled = Boolean(process.env.AUTH_GOOGLE_ID && process.env.AUTH_GOOGLE_SECRET);
 
 
 
 
 
4
 
5
  export default function LoginPage() {
 
 
6
  return (
7
  <div className="mx-auto max-w-xl space-y-5">
8
  <section className="hero-panel reveal-up">
9
+ <p className="kicker">Google Login</p>
10
  <h1 className="section-title mt-2 text-3xl">Sign in as idea submitter or developer</h1>
11
+ <p className="subtle mt-3 text-sm">Google is the only enabled auth provider right now.</p>
 
 
12
  </section>
13
 
14
  <section className="card space-y-3">
15
+ {!googleEnabled ? (
16
  <p className="text-sm text-red-700">
17
+ Google auth is not configured yet. Add `AUTH_GOOGLE_ID` and `AUTH_GOOGLE_SECRET`.
18
  </p>
19
  ) : (
20
+ <form
21
+ action={async () => {
22
+ "use server";
23
+ await signIn("google", { redirectTo: "/" });
24
+ }}
25
+ >
26
+ <button className="btn w-full" type="submit">
27
+ Continue with Google
28
+ </button>
29
+ </form>
 
 
 
30
  )}
31
  </section>
32
  </div>
auth.ts CHANGED
@@ -1,48 +1,17 @@
1
  import NextAuth from "next-auth";
2
  import Google from "next-auth/providers/google";
3
- import GitHub from "next-auth/providers/github";
4
- import Apple from "next-auth/providers/apple";
5
- import Facebook from "next-auth/providers/facebook";
6
  import { PrismaAdapter } from "@auth/prisma-adapter";
7
  import { prisma } from "@/lib/prisma";
8
 
9
- const providers = [];
10
-
11
- if (process.env.AUTH_GOOGLE_ID && process.env.AUTH_GOOGLE_SECRET) {
12
- providers.push(
13
- Google({
14
- clientId: process.env.AUTH_GOOGLE_ID,
15
- clientSecret: process.env.AUTH_GOOGLE_SECRET,
16
- })
17
- );
18
- }
19
-
20
- if (process.env.AUTH_GITHUB_ID && process.env.AUTH_GITHUB_SECRET) {
21
- providers.push(
22
- GitHub({
23
- clientId: process.env.AUTH_GITHUB_ID,
24
- clientSecret: process.env.AUTH_GITHUB_SECRET,
25
- })
26
- );
27
- }
28
-
29
- if (process.env.AUTH_APPLE_ID && process.env.AUTH_APPLE_SECRET) {
30
- providers.push(
31
- Apple({
32
- clientId: process.env.AUTH_APPLE_ID,
33
- clientSecret: process.env.AUTH_APPLE_SECRET,
34
- })
35
- );
36
- }
37
-
38
- if (process.env.AUTH_FACEBOOK_ID && process.env.AUTH_FACEBOOK_SECRET) {
39
- providers.push(
40
- Facebook({
41
- clientId: process.env.AUTH_FACEBOOK_ID,
42
- clientSecret: process.env.AUTH_FACEBOOK_SECRET,
43
- })
44
- );
45
- }
46
 
47
  export const { handlers, auth, signIn, signOut } = NextAuth({
48
  adapter: PrismaAdapter(prisma),
 
1
  import NextAuth from "next-auth";
2
  import Google from "next-auth/providers/google";
 
 
 
3
  import { PrismaAdapter } from "@auth/prisma-adapter";
4
  import { prisma } from "@/lib/prisma";
5
 
6
+ const providers =
7
+ process.env.AUTH_GOOGLE_ID && process.env.AUTH_GOOGLE_SECRET
8
+ ? [
9
+ Google({
10
+ clientId: process.env.AUTH_GOOGLE_ID,
11
+ clientSecret: process.env.AUTH_GOOGLE_SECRET,
12
+ }),
13
+ ]
14
+ : [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  export const { handlers, auth, signIn, signOut } = NextAuth({
17
  adapter: PrismaAdapter(prisma),