K
Kinde3mo ago
Joshkop

Use callbacks_url with and without intl18 subdomains

Hello, Im using nextintls subdomain routing for in18 But if users try to login from a in18 subdomain like "de.domain.com" instead of "domain.com" I get the sate flow not expected error Since its the same nextjs app for all subdomains, I cant add the callback url dynamicly on build time Is the only way now using wildcards? If so do I just need to set these envs:
KINDE_POST_LOGIN_REDIRECT_URL=https://*.domain.com
KINDE_POST_LOGOUT_REDIRECT_URL=https://*.domain.com
KINDE_POST_LOGIN_REDIRECT_URL=https://*.domain.com
KINDE_POST_LOGOUT_REDIRECT_URL=https://*.domain.com
or do i also set KINDE_SITE_URL to the wildcard ? What happens then to the normal domain at "domain.com" Since it is not a subdomain does that even work still?
5 Replies
Joshkop
JoshkopOP3mo ago
wildcards in the allowed list have also been set obviously Oh i just saw that the docs for wildcards are probably only for the allowed list correct ? So theres no way to set the redirect url there to be able to use the subomains? Hmm even using different org_codes wouldnt work i guess since i cant edit the env vars post build Is there a way to set the full redirect url at runtime ?
Joshkop
JoshkopOP3mo ago
Could I route them from "de.domain.com" to "domain.com/api/auth/login" ? This would then callback to the main domain after login and the user could switch languages again. Not ideal but bettern then not being able to login The docs say I can set COOKIE_DOMAIN=.domain.com for subdomains Is that meant as just the dot or do I need the subdomain there ? Cause if I use just .domain.com nextjs says its an invalid url If I have to set the full subdomain there I'd have the same problem as with the other solutions I tried Ok i just set the env validation wrong Will test if this solution works
No description
IkiTg07
IkiTg073mo ago
Hey that's a hell of a problem you have here ! How did it went ? Let me know if you're still having issue i'll report to the team
Joshkop
JoshkopOP3mo ago
It worked when setting the COOKI_DOMAIN to .domain with the dot I copied the validation as COOKIE_DOMAIN: z.string().url() from the redirect urls Which is why I couldnt get it to work ... took me way too long to find that I can now also use the following:
postLoginRedirectURL={`/${locale}/${pathName}`}>
postLoginRedirectURL={`/${locale}/${pathName}`}>
which correctly redirects them bag to the correct in18 subdomain Maybe add to the wildcard docs that this only is for the allowed redirects on kinde and not usable for the SDKs env variable Took me hours to find that out ^^ Also the postLogoutRedirectUrl sadly doesnt work the same ass the postLogin one If I use for example "/de/" it throws an error
IkiTg07
IkiTg073mo ago
Glad you fixed it. I’ll tell the team about your case for them to add it to the docs
Want results from more Discord servers?
Add your server