Seeking Solace
Seeking Solace2mo ago

How to force consent screen on log in? (Google OAuth + Convex Auth)

When I sign in using Google OAuth with Convex, I don't get the option to pick an account. It just automatically logs in with the latest account. How do I force account selection every time the user clicks the login button? For reference, this is how my login component looks like:
"use client";

import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { useAuthActions } from "@convex-dev/auth/react";
import { useTranslations } from "next-intl";
import { FaGoogle } from "react-icons/fa";

export default function GoogleAuth({
className,
isIcon,
}: {
className?: string;
isIcon?: boolean;
}) {
const { signIn } = useAuthActions();
const t = useTranslations("Auth");

return (
<Button onClick={() => signIn("google")} className={cn(className)}>
<FaGoogle />
{!isIcon && t("signIn")}
</Button>
);
}
"use client";

import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { useAuthActions } from "@convex-dev/auth/react";
import { useTranslations } from "next-intl";
import { FaGoogle } from "react-icons/fa";

export default function GoogleAuth({
className,
isIcon,
}: {
className?: string;
isIcon?: boolean;
}) {
const { signIn } = useAuthActions();
const t = useTranslations("Auth");

return (
<Button onClick={() => signIn("google")} className={cn(className)}>
<FaGoogle />
{!isIcon && t("signIn")}
</Button>
);
}
1 Reply
Seeking Solace
Seeking SolaceOP2mo ago
Looks like that's an intended behavior: If the user has 2 or more accounts they would get a consent screen on every login. If a user has only one account, no consent screen pops up. I went ahead and signed in into another Google account on my browser, and the consent screens aren't getting skipped anymore.

Did you find this page helpful?