chore: update demo

This commit is contained in:
Bereket Engida
2024-11-18 14:21:07 +03:00
parent e442627c61
commit 5853da4ba1
7 changed files with 88 additions and 62 deletions

View File

@@ -109,10 +109,10 @@ export default function SignIn() {
> >
{loading ? <Loader2 size={16} className="animate-spin" /> : "Login"} {loading ? <Loader2 size={16} className="animate-spin" /> : "Login"}
</Button> </Button>
<div className="flex items-center gap-2"> <div className="grid grid-cols-4 gap-2">
<Button <Button
variant="outline" variant="outline"
className="w-full gap-2" className="gap-2"
onClick={async () => { onClick={async () => {
await signIn.social({ await signIn.social({
provider: "github", provider: "github",
@@ -124,7 +124,7 @@ export default function SignIn() {
</Button> </Button>
<Button <Button
variant="outline" variant="outline"
className="w-full gap-2" className="gap-2"
onClick={async () => { onClick={async () => {
await signIn.social({ await signIn.social({
provider: "discord", provider: "discord",
@@ -135,60 +135,7 @@ export default function SignIn() {
</Button> </Button>
<Button <Button
variant="outline" variant="outline"
className="w-full gap-2" className=" gap-2"
onClick={async () => {
await signIn.social({
provider: "twitch",
callbackURL: "/dashboard",
});
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="1.2em"
height="1.2em"
viewBox="0 0 24 24"
>
<path
fill="currentColor"
d="M11.64 5.93h1.43v4.28h-1.43m3.93-4.28H17v4.28h-1.43M7 2L3.43 5.57v12.86h4.28V22l3.58-3.57h2.85L20.57 12V2m-1.43 9.29l-2.85 2.85h-2.86l-2.5 2.5v-2.5H7.71V3.43h11.43Z"
></path>
</svg>
</Button>
<Button
variant="outline"
className="w-full gap-2"
onClick={async () => {
await signIn.social({
provider: "twitter",
callbackURL: "/dashboard",
});
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 14 14"
>
<g fill="none">
<g clipPath="url(#primeTwitter0)">
<path
fill="currentColor"
d="M11.025.656h2.147L8.482 6.03L14 13.344H9.68L6.294 8.909l-3.87 4.435H.275l5.016-5.75L0 .657h4.43L7.486 4.71zm-.755 11.4h1.19L3.78 1.877H2.504z"
></path>
</g>
<defs>
<clipPath id="primeTwitter0">
<path fill="#fff" d="M0 0h14v14H0z"></path>
</clipPath>
</defs>
</g>
</svg>
</Button>
<Button
variant="outline"
className="w-full gap-2"
onClick={async () => { onClick={async () => {
await signIn.social({ await signIn.social({
provider: "google", provider: "google",
@@ -222,7 +169,7 @@ export default function SignIn() {
</Button> </Button>
<Button <Button
variant="outline" variant="outline"
className="w-full gap-2" className="gap-2"
onClick={async () => { onClick={async () => {
await signIn.social({ await signIn.social({
provider: "microsoft", provider: "microsoft",
@@ -242,6 +189,82 @@ export default function SignIn() {
></path> ></path>
</svg> </svg>
</Button> </Button>
<Button
variant="outline"
className="gap-2"
onClick={async () => {
await signIn.social({
provider: "twitch",
callbackURL: "/dashboard",
});
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="1.2em"
height="1.2em"
viewBox="0 0 24 24"
>
<path
fill="currentColor"
d="M11.64 5.93h1.43v4.28h-1.43m3.93-4.28H17v4.28h-1.43M7 2L3.43 5.57v12.86h4.28V22l3.58-3.57h2.85L20.57 12V2m-1.43 9.29l-2.85 2.85h-2.86l-2.5 2.5v-2.5H7.71V3.43h11.43Z"
></path>
</svg>
</Button>
<Button
variant="outline"
className="gap-2"
onClick={async () => {
await signIn.social({
provider: "facebook",
callbackURL: "/dashboard",
});
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="1.3em"
height="1.3em"
viewBox="0 0 24 24"
>
<path
fill="currentColor"
d="M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12c0 4.84 3.44 8.87 8 9.8V15H8v-3h2V9.5C10 7.57 11.57 6 13.5 6H16v3h-2c-.55 0-1 .45-1 1v2h3v3h-3v6.95c5.05-.5 9-4.76 9-9.95"
></path>
</svg>
</Button>
<Button
variant="outline"
className="gap-2"
onClick={async () => {
await signIn.social({
provider: "twitter",
callbackURL: "/dashboard",
});
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 14 14"
>
<g fill="none">
<g clipPath="url(#primeTwitter0)">
<path
fill="currentColor"
d="M11.025.656h2.147L8.482 6.03L14 13.344H9.68L6.294 8.909l-3.87 4.435H.275l5.016-5.75L0 .657h4.43L7.486 4.71zm-.755 11.4h1.19L3.78 1.877H2.504z"
></path>
</g>
<defs>
<clipPath id="primeTwitter0">
<path fill="#fff" d="M0 0h14v14H0z"></path>
</clipPath>
</defs>
</g>
</svg>
</Button>
</div> </div>
<Button <Button
variant="outline" variant="outline"

View File

@@ -80,6 +80,10 @@ export const auth = betterAuth({
}, },
}, },
socialProviders: { socialProviders: {
facebook: {
clientId: process.env.FACEBOOK_CLIENT_ID || "",
clientSecret: process.env.FACEBOOK_CLIENT_SECRET || "",
},
github: { github: {
clientId: process.env.GITHUB_CLIENT_ID || "", clientId: process.env.GITHUB_CLIENT_ID || "",
clientSecret: process.env.GITHUB_CLIENT_SECRET || "", clientSecret: process.env.GITHUB_CLIENT_SECRET || "",

View File

@@ -419,4 +419,4 @@
"files": [ "files": [
"dist" "dist"
] ]
} }

View File

@@ -10,6 +10,7 @@ import { createAuthEndpoint } from "../call";
const schema = z.object({ const schema = z.object({
code: z.string().optional(), code: z.string().optional(),
error: z.string().optional(), error: z.string().optional(),
errorMessage: z.string().optional(),
state: z.string().optional(), state: z.string().optional(),
}); });

View File

@@ -131,7 +131,6 @@ describe("email-otp", async () => {
type: "sign-in", type: "sign-in",
}, },
}); });
console.log(res);
}); });
}); });

View File

@@ -243,7 +243,6 @@ describe("organization", async (it) => {
headers, headers,
}, },
}); });
console.log(org);
if (!org.data) throw new Error("Organization not found"); if (!org.data) throw new Error("Organization not found");
expect(org.data.members[0].role).toBe("owner"); expect(org.data.members[0].role).toBe("owner");
const removedMember = await client.organization.removeMember({ const removedMember = await client.organization.removeMember({

View File

@@ -22,7 +22,7 @@ export const facebook = (options: FacebookOptions) => {
id: "facebook", id: "facebook",
name: "Facebook", name: "Facebook",
async createAuthorizationURL({ state, scopes, redirectURI }) { async createAuthorizationURL({ state, scopes, redirectURI }) {
const _scopes = scopes || ["email"]; const _scopes = scopes || ["email", "public_profile"];
options.scope && _scopes.push(...options.scope); options.scope && _scopes.push(...options.scope);
return await createAuthorizationURL({ return await createAuthorizationURL({
id: "facebook", id: "facebook",