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 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)
1 Reply
ddev
ddevOP2mo ago
Solution: prompt: "select_account consent" as "select_account+consent",

Did you find this page helpful?