K
Kinde2mo ago
Clémence

Can we send the signin link of our app in an Email from my NextJS app?

Hello! I'm using NextJS with Kinde and I would like to know if it's possible to create a link that could be send in an email so the user can directly access the sign in page
2 Replies
Clémence
ClémenceOP2mo ago
I managed to make it work by using it 'raw,' but there might be a cleaner way to do this.
const link = `${process.env.NEXT_PUBLIC_BASE_URL}/api/auth/login?post_login_redirect_url=${process.env.NEXT_PUBLIC_BASE_URL}/dashboard`;
const link = `${process.env.NEXT_PUBLIC_BASE_URL}/api/auth/login?post_login_redirect_url=${process.env.NEXT_PUBLIC_BASE_URL}/dashboard`;
Yoshify
Yoshify2mo ago
Hi Clemence, That method there is exactly how you should be doing it. The only improvement I could suggest is that instead of putting the redirect query parameter in the link, you could just leverage the KINDE_POST_LOGIN_REDIRECT_URL environment variable (assuming you'll always be redirected to the same place after login)

Did you find this page helpful?