Problem when deploying authentication on the server

Hello. I have a vuejs application that uses authentication via better auth, deployed with express. When I tested with my local dev server, everything worked perfectly. When I deployed my authentication system on my server (behind a reverse proxy caddy and executed with pm2), I can connect and register without any problem, however, when I try to retrieve my current session with auth.useSession(), it returns the result on the screenshot. I should point out that when I switched back to my test server, it started working properly again. Please note that I'm using Capacitor, so I don't know if that makes any difference.
No description
1 Reply
Loris 🐐
Loris 🐐OP4mo ago
also here is my config:
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { db } from "./database";
import { bearer, organization } from "better-auth/plugins";
import { origins } from "./cors";
export const auth = betterAuth({
database: prismaAdapter(db, {
provider: "postgresql"
}),
trustedOrigins: origins,
plugins: [organization(), bearer()],
emailAndPassword: {
enabled: true
}
})
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { db } from "./database";
import { bearer, organization } from "better-auth/plugins";
import { origins } from "./cors";
export const auth = betterAuth({
database: prismaAdapter(db, {
provider: "postgresql"
}),
trustedOrigins: origins,
plugins: [organization(), bearer()],
emailAndPassword: {
enabled: true
}
})

Did you find this page helpful?