401 error Nextjs(cookies not being sent)

To Reproduce Using express backend with drizzle My apis arent being sent from frontend to backend, in nextjs, tried using with crenetials also
export const axiosInstance = axios.create({
baseURL,
headers: {
'Content-Type': 'application/json',
},
withCredentials: true,
});
export const axiosInstance = axios.create({
baseURL,
headers: {
'Content-Type': 'application/json',
},
withCredentials: true,
});
By default my page is a server component-
export default async function DashboardPage() {

const videos = await getVideosFetcher();
console.log('videos', videos);

return (


<Button className={cn(styles.addVideoButton, 'button-primary')}>
+ Create Video


{/* {videos.map((video, idx) => (

))} */}


);
}
export default async function DashboardPage() {

const videos = await getVideosFetcher();
console.log('videos', videos);

return (


<Button className={cn(styles.addVideoButton, 'button-primary')}>
+ Create Video


{/* {videos.map((video, idx) => (

))} */}


);
}
Current vs. Expected behavior To validate request and return variable, but gets 401 unautrized What version of Better Auth are you using? 1.2.7 Provide environment information Macos chrome node v20.17.0 Which area(s) are affected? (Select all that apply) Client Auth config My backend auth setup is
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: 'pg',
// debugLogs: true,
usePlural: true,
}),
emailAndPassword: {
enabled: true,
autoSignIn: true,
},
// emailVerification: {
// sendOnSignUp: true,
// },
logger: {
level: 'debug',
transport: {
type: 'console',
options: {
format: 'json',
},
},
},
trustedOrigins: ['https://localhost:3000'],
advanced: {
defaultCookieAttributes: {
sameSite: 'none',
secure: true,
},
},
crossSubDomainCookies: {
enabled: true,
domain: 'https://localhost:3000', // Domain with a leading period
},
});
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: 'pg',
// debugLogs: true,
usePlural: true,
}),
emailAndPassword: {
enabled: true,
autoSignIn: true,
},
// emailVerification: {
// sendOnSignUp: true,
// },
logger: {
level: 'debug',
transport: {
type: 'console',
options: {
format: 'json',
},
},
},
trustedOrigins: ['https://localhost:3000'],
advanced: {
defaultCookieAttributes: {
sameSite: 'none',
secure: true,
},
},
crossSubDomainCookies: {
enabled: true,
domain: 'https://localhost:3000', // Domain with a leading period
},
});
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?