OAuth proxy is not working in local and preview environments. I've
- configured the github oauth app with the production url
- added oauth proxy plugin
- added redirectURI to the social provider config
But still getting the error in the image. My auth config is as below:
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
usePlural: true,
}),
user: {
changeEmail: {
enabled: true,
sendChangeEmailVerification,
},
},
emailVerification: {
sendVerificationEmail,
},
advanced: {
generateId: false,
cookiePrefix: "website",
crossSubDomainCookies: {
enabled: true,
domain: "app.website.com",
},
},
trustedOrigins: [
"https://app.website.com",
],
socialProviders: {
google: {
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
redirectURI: "https://app.website.com/api/auth/callback/google",
},
github: {
clientId: env.GITHUB_CLIENT_ID,
clientSecret: env.GITHUB_CLIENT_SECRET,
redirectURI: "https://app.website.com/api/auth/callback/github",
},
},
databaseHooks: {
user: {
create: {
after: afterUserCreated,
},
},
session: {
create: {
before: beforeSessionCreated,
},
},
},
plugins: [
nextCookies(),
organization({
sendInvitationEmail,
}),
admin(),
magicLink({
sendMagicLink,
}),
oAuthProxy(),
customSession(customizeSession),
],
});
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
usePlural: true,
}),
user: {
changeEmail: {
enabled: true,
sendChangeEmailVerification,
},
},
emailVerification: {
sendVerificationEmail,
},
advanced: {
generateId: false,
cookiePrefix: "website",
crossSubDomainCookies: {
enabled: true,
domain: "app.website.com",
},
},
trustedOrigins: [
"https://app.website.com",
],
socialProviders: {
google: {
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
redirectURI: "https://app.website.com/api/auth/callback/google",
},
github: {
clientId: env.GITHUB_CLIENT_ID,
clientSecret: env.GITHUB_CLIENT_SECRET,
redirectURI: "https://app.website.com/api/auth/callback/github",
},
},
databaseHooks: {
user: {
create: {
after: afterUserCreated,
},
},
session: {
create: {
before: beforeSessionCreated,
},
},
},
plugins: [
nextCookies(),
organization({
sendInvitationEmail,
}),
admin(),
magicLink({
sendMagicLink,
}),
oAuthProxy(),
customSession(customizeSession),
],
});