Welcome to the Kinde community

Updated 9 months ago

NextJS SDK needs documentation on custom domain

At a glance

The community member who posted the original post expressed that the Nextjs SDK documentation should have more information on how to implement custom domains for authentication. They have asked for support on this issue but have not found a solution yet. In the comments, another community member responded that they have passed on the feedback to the documentation team. They also suggested that the original poster might be missing the KINDE_COOKIE_DOMAIN environment variable in their .env file, and provided a link to the relevant section of the NextJS docs.

Another community member responded that they were able to get it working, but had to set the KINDE_COOKIE_DOMAIN only in their Vercel dev environment, and not in their preview, production, or local environments. They also mentioned getting mixed up with VERCEL_URL and VERCEL_BRANCH_URL, and suggested that the documentation could be improved to clarify the difference between these two environment variables.

There is no explicitly marked answer in the comments.

Useful resources
The Nextjs SDK documentation should have more documentation on how to implement custom domains for auth. I've asked here for support on it and have yet to find a solution, but even when I do, the docs should be a bit more helpful here.
O
J
2 comments
Hey @Jeremy,
Sorry that you have been experiencing issues with implementing custom domains for auth with your NextJS app.
I have passed on your feedback on documentation to my team mate who handles our docs.

I assume you have already setup your custom domain in the Kinde Admin.

From looking at the message in the past support thread here, I believe you are missing KINDE_COOKIE_DOMAIN in your .env file.

So I would suggest having a read of this section of the NextJS docs.

Please let me know if you are still experiencing issues.
Thank you, I think I finally got it working as well as I can. I did the cookie thing, but importantly only had to set that on my vercel dev env (not preview envs, prod, or local). Also I was getting mixed up with VERCEL_URL and VERCEL_BRANCH_URL. Following the custom domain and preview docs, that implements VERCEL_URL, which is not what the Vercel Github bot uses. I added a comment here: https://github.com/kinde-oss/kinde-auth-nextjs/issues/86#issuecomment-2064915911

I think I'm good now I'm just trying to elaborate in case you want to add to the docs the difference between VERCEL_URL and VERCEL_BRANCH_URL. And that you can not get both to work, because the env vars are set at build time so you can't dynamically figure out which host the user is using.
Add a reply
Sign up and join the conversation on Discord