Welcome to the Kinde community.

P
K
A
A
A

Stripe success_url from checkout session logs user out.

const session = await stripeClient.checkout.sessions.create({
success_url: `https://mydomain.com/restoflink and https://mydomain-staging.com/restoflink

Hello, when my application gets redirected to the success_url on staging, the user is still logged in (cookies are still set, etc) and correctly redirects to the success_url. However, on my production url, the user is always logged out and redirected to my home page.


Here's the code for the specific page I want to redirect to:

const {getPermission, getUser} = getKindeServerSession();
const user = await getUser()
const isAdmin = await getPermission("xxxx")

if (!user) {
redirect('/')
}

const userExists = await db.query.users.findFirst({
where: (fields) => eq(fields.kindeId, user.id)
});

if (!userExists) {
redirect('/')
}


const courseExists = await getCourseBySlug(params.course)

if (!courseExists) {
return <p className="mx-auto text-center font-extrabold mt-40">Course not found</p>;
}

if (!courseExists.isPublished && !isAdmin?.isGranted) {
redirect('/')
}
g
I
2 comments
NOTE: I tried redirecting to my base url. like 'https://mydomain.com" and it still signs me out.
This is weird. Does it mean the cookies are deleted when you're doing the actions on your prod env ?
Add a reply
Sign up and join the conversation on Discord
Join