Google Oauth Scopes Error
src/lib/auth.tssrc/lib/auth.tsimport { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { prisma } from "./prisma";
export const auth = betterAuth({
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
// Request scopes needed for Google Docs reading:
scope: "openid email profile https://www.googleapis.com/auth/documents.readonly https://www.googleapis.com/auth/drive.metadata.readonly",
},
},
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
user: {
additionalFields: {
education: { type: "string", required: false },
school: { type: "string", required: false },
onboardingCompleted: {
type: "boolean",
required: false,
defaultValue: false,
},
},
},
});import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { prisma } from "./prisma";
export const auth = betterAuth({
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
// Request scopes needed for Google Docs reading:
scope: "openid email profile https://www.googleapis.com/auth/documents.readonly https://www.googleapis.com/auth/drive.metadata.readonly",
},
},
database: prismaAdapter(prisma, {
provider: "postgresql",
}),
user: {
additionalFields: {
education: { type: "string", required: false },
school: { type: "string", required: false },
onboardingCompleted: {
type: "boolean",
required: false,
defaultValue: false,
},
},
},
});Error:
Some requested scopes were invalid. {valid=[https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile, openid], invalid=[a, c, d, e, f, g, h, i, l, m, n, ., o, /, p, r, s, t, u, v, w, y, :]} Learn more about this error
If you are a developer of SparkStudy, see error details.
Error 400: invalid_scopeSome requested scopes were invalid. {valid=[https://www.googleapis.com/auth/userinfo.email, https://www.googleapis.com/auth/userinfo.profile, openid], invalid=[a, c, d, e, f, g, h, i, l, m, n, ., o, /, p, r, s, t, u, v, w, y, :]} Learn more about this error
If you are a developer of SparkStudy, see error details.
Error 400: invalid_scopeError 400: invalid_scope
Request details: flowName=GeneralOAuthFlowError 400: invalid_scope
Request details: flowName=GeneralOAuthFlowThis was working before adding the
https://www.googleapis.com/auth/documents.readonlyhttps://www.googleapis.com/auth/documents.readonly and https://www.googleapis.com/auth/drive.metadata.readonlyhttps://www.googleapis.com/auth/drive.metadata.readonly scopes