Skip to content

Commit a2bb4f5

Browse files
authored
chore: fine tune auth config (#105)
* chore: fine tune auth config * feat: set oidc scopes fallback * fix: icons * refactor: remove vercel svg and rename title,description metadata * test: leftover * feat: split server vs client components render
1 parent 1c13f23 commit a2bb4f5

File tree

16 files changed

+69
-68
lines changed

16 files changed

+69
-68
lines changed

public/file.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/globe.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/next.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/vercel.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/window.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/app/favicon.ico

-25.3 KB
Binary file not shown.

src/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const inter = Inter({
1010
});
1111

1212
export const metadata: Metadata = {
13-
title: "Create Next App",
14-
description: "Generated by create next app",
13+
title: "ToolHive Cloud UI",
14+
description: "ToolHive Cloud UI for managing MCP servers",
1515
};
1616

1717
export default async function RootLayout({

src/app/signin/__tests__/signin.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ describe("SignInPage", () => {
5050
expect(authClient.signIn.oauth2).toHaveBeenCalledWith({
5151
providerId: "oidc",
5252
callbackURL: "/catalog",
53-
scopes: ["openid", "email", "profile", "offline_access"],
5453
});
5554
});
5655
});

src/app/signin/page.tsx

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,26 @@
1-
"use client";
2-
3-
import Image from "next/image";
4-
import { toast } from "sonner";
5-
import { ToolhiveIcon } from "@/components/toolhive-icon";
6-
import { Button } from "@/components/ui/button";
7-
import { authClient } from "@/lib/auth/auth-client";
8-
import { OIDC_PROVIDER_ID } from "@/lib/auth/constants";
1+
import { ToolHiveIcon } from "@/components/icons";
2+
import { SignInButton } from "./signin-button";
93

104
export default function SignInPage() {
11-
const handleOIDCSignIn = async () => {
12-
try {
13-
const { error } = await authClient.signIn.oauth2({
14-
providerId: OIDC_PROVIDER_ID,
15-
callbackURL: "/catalog",
16-
scopes: ["openid", "email", "profile", "offline_access"],
17-
});
18-
19-
if (error) {
20-
toast.error("Signin failed", {
21-
description:
22-
error.message ||
23-
"An error occurred during signin. Please try again.",
24-
});
25-
return;
26-
}
27-
} catch (error) {
28-
const errorMessage =
29-
error instanceof Error ? error.message : "An unexpected error occurred";
30-
31-
toast.error("Signin error", {
32-
description: errorMessage,
33-
});
34-
}
35-
};
36-
375
return (
386
<div className="flex h-screen w-full">
39-
{/* Left Side - Logo Section */}
407
<div className="hidden md:flex w-1/2 bg-muted/80 border-r border-border items-start p-10">
418
<div className="flex items-center gap-4">
42-
<ToolhiveIcon className="h-5 shrink-0" />
9+
<ToolHiveIcon className="size-8 shrink-0" />
4310
<h1 className="text-4xl font-bold tracking-tight">ToolHive</h1>
4411
</div>
4512
</div>
4613

47-
{/* Right Side - Sign In Form */}
4814
<div className="flex w-full md:w-1/2 items-center justify-center p-8">
4915
<div className="flex flex-col items-center space-y-6 w-full max-w-[350px]">
50-
{/* Header */}
5116
<div className="flex flex-col items-center space-y-2 text-center">
5217
<h2 className="text-3xl font-semibold tracking-tight">Sign in</h2>
5318
<p className="text-sm text-muted-foreground">
5419
Sign in using your company credentials
5520
</p>
5621
</div>
5722

58-
{/* Sign In Button */}
59-
<Button
60-
onClick={handleOIDCSignIn}
61-
className="w-full h-9 gap-2"
62-
size="default"
63-
>
64-
<Image
65-
src="/okta-icon.svg"
66-
alt="Okta"
67-
width={16}
68-
height={16}
69-
className="shrink-0"
70-
/>
71-
<span>Okta</span>
72-
</Button>
23+
<SignInButton />
7324
</div>
7425
</div>
7526
</div>

src/app/signin/signin-button.tsx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"use client";
2+
import Image from "next/image";
3+
import { toast } from "sonner";
4+
import { Button } from "@/components/ui/button";
5+
import { authClient } from "@/lib/auth/auth-client";
6+
import { OIDC_PROVIDER_ID } from "@/lib/auth/constants";
7+
export function SignInButton() {
8+
const handleOIDCSignIn = async () => {
9+
try {
10+
const { error } = await authClient.signIn.oauth2({
11+
providerId: OIDC_PROVIDER_ID,
12+
callbackURL: "/catalog",
13+
});
14+
15+
if (error) {
16+
toast.error("Signin failed", {
17+
description:
18+
error.message ||
19+
"An error occurred during signin. Please try again.",
20+
});
21+
return;
22+
}
23+
} catch (error) {
24+
const errorMessage =
25+
error instanceof Error ? error.message : "An unexpected error occurred";
26+
27+
toast.error("Signin error", {
28+
description: errorMessage,
29+
});
30+
}
31+
};
32+
33+
return (
34+
<Button
35+
onClick={handleOIDCSignIn}
36+
className="w-full h-9 gap-2"
37+
size="default"
38+
>
39+
<Image
40+
src="/okta-icon.svg"
41+
alt="Okta"
42+
width={16}
43+
height={16}
44+
className="shrink-0"
45+
/>
46+
<span>Okta</span>
47+
</Button>
48+
);
49+
}

0 commit comments

Comments
 (0)