Google Provider prompt parameter type mismatch causes OAuth error

I'm encountering an issue with the Google OAuth provider configuration in better-auth. According to the documentation, to always get a refresh token, I should set prompt to "select_account+consent" as in documentation, but this causes a Google OAuth error.
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
accessType: "offline",
prompt: "select_account+consent", // As per documentation
},
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
accessType: "offline",
prompt: "select_account+consent", // As per documentation
},
},
Error from Google:
Invalid parameter value for prompt: Invalid prompt: select_account+consent
Error 400: invalid_request
Invalid parameter value for prompt: Invalid prompt: select_account+consent
Error 400: invalid_request
TypeScript Issue: When I try to use the correct Google OAuth format with space separation:
prompt: "select_account consent"
Type '"select_account consent"' is not assignable to type '"select_account" | "consent" | "login" | "none" | "select_account+consent" | undefined'.
Did you mean '"select_account+consent"'?ts(2820)
prompt: "select_account consent"
Type '"select_account consent"' is not assignable to type '"select_account" | "consent" | "login" | "none" | "select_account+consent" | undefined'.
Did you mean '"select_account+consent"'?ts(2820)
Solution: prompt: "select_account consent" as "select_account+consent", but i think this is a bug as there is a clear mismatch between their types and the actual Google OAuth API requirements. better-auth: "^1.2.12", next: "15.3.5", node: "22.9.0", pnpm: "10.9.0"
Solution:
in better-auth 1.3.2 version error is fixed. So guys you ahve to just update ypur package.
Jump to solution
4 Replies
ddev
ddevOP3mo ago
ping Pong
Ping
Ping3mo ago
@ddev Can you try on the latest version?
ddev
ddevOP3mo ago
yes i would try
Solution
ddev
ddev3mo ago
in better-auth 1.3.2 version error is fixed. So guys you ahve to just update ypur package.

Did you find this page helpful?