Welcome to the Kinde community.

A
A
A
M
T

Nextjs kinde site url environment variable usage

I’m using the next.js SDK. should I define KINDE_SITE_URL environment variable? how is it being used?

K
1 comment

Yes, you should define the `KINDE_SITE_URL` environment variable when using the Next.js SDK. This variable is used to specify the URL where your app is running. It is essential for ensuring that the authentication flow works correctly, especially when dealing with dynamically generated preview URLs in environments like Vercel. The `KINDE_SITE_URL` is used in the `next.config.js` file to populate the Kinde variables dynamically. Here is an example configuration: ``` /** @type {import('next').NextConfig} */ const nextConfig = { env: { KINDE_SITE_URL: process.env.KINDE_SITE_URL ?? `https://${process.env.VERCEL_URL}`, KINDE_POST_LOGOUT_REDIRECT_URL: process.env.KINDE_POST_LOGOUT_REDIRECT_URL ?? `https://${process.env.VERCEL_URL}`, KINDE_POST_LOGIN_REDIRECT_URL: process.env.KINDE_POST_LOGIN_REDIRECT_URL ?? `https://${process.env.VERCEL_URL}/dashboard` } }; module.exports = nextConfig; ``` This ensures that Vercel uses its generated preview URLs to populate the three Kinde variables, including `KINDE_SITE_URL`. For more detailed information, you can refer to the .

Add a reply
Sign up and join the conversation on Slack
Join