Seeking Solace
Seeking Solace2mo ago

When I sign in using Google OAuth with

When I sign in using Google OAuth with Convex Auth, I don't get the option to pick an account. It just automatically logs in with the latest used account. How do I force account selection every time the user clicks the login button?
const { signIn } = useAuthActions();
const t = useTranslations("Auth");

return (
<Button
onClick={() => signIn("google", { prompt: "select_account" })}
className={cn(className)}
>
<FaGoogle />
{!isIcon && t("signIn")}
</Button>
);
const { signIn } = useAuthActions();
const t = useTranslations("Auth");

return (
<Button
onClick={() => signIn("google", { prompt: "select_account" })}
className={cn(className)}
>
<FaGoogle />
{!isIcon && t("signIn")}
</Button>
);
5 Replies
erquhart
erquhart2mo ago
There isn't a way to force it within Auth.js (which Convex Auth is based on), but I'm also seeing that every time I log out, I'm asked to select an account on login. You can try it at the Convex V1 template site: https://convex-v1.run/
Create v1
A free, open-source starter kit for your next project, built with insights from Midday.
Seeking Solace
Seeking SolaceOP2mo ago
I see. I just tried signing in into the site. Same issue. Consent screen on first login, and then no consent screen after. Maybe it has to do with me having only one account currently logged in with Google on my current browser. Will login into another and try again. It's really limiting that the consent screen is skipped by default and that there's no way to change that.
erquhart
erquhart2mo ago
Google itself apparently accepts a "prompt=consent" param, but Auth.js doesn't configure for it. It's possible it's something that can be set up in your configuration in the Google console, but I didn't find it.
Seeking Solace
Seeking SolaceOP2mo ago
Okay, apparently, 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. I apologize for wasting your time as usual, Erquhart. I really appreciate the help!
erquhart
erquhart2mo ago
No problem!

Did you find this page helpful?