Nathaly Toledo - Kinde
KKinde
•Created by Marcin on 3/25/2025 in #💻┃support
Kinde Auth Callback Issue on my domain
3. Additional recommendation:
Using wildcards for production introduces some security risks, so this is suggested for non-production environments only.
We recommend using wildcards only for non-production purposes, as they present increased security risk.A more secure way of managing dynamic wildcards is to integrate with the Kinde Management API and manage them via API calls. There is a dedicated documentation page for this that happens to be focused on Vercel and Next.js. This is the link in case you are not already aware of it and feel interested: https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk/#working-with-preview-urls Of course, it is up to you and what works for your case. Let me know if these helped so that I can assist your further in the case they were not helpful.
8 replies
KKinde
•Created by Marcin on 3/25/2025 in #💻┃support
Kinde Auth Callback Issue on my domain
2. Limitations with wildcards
From the code you shared, you seem to be using wildcards with your Vercel domain. Here are some notes to keep in mind, and I have highlighted the ones that may apply to your case given the details you shared:
- Root level domains are not allowed (.com is not allowed). - Only a single wildcard is allowed per callback (https://..hello.com is not allowed). - Wildcards are only allowed with http or https URL protocols (.hello.com, service:jmx:rmi://[host[:port]][urlPath] are not allowed). - Wildcard has to be in the leftmost subdomain (https://*.hello.com is allowed, https://hello.*.com is not allowed). - Wildcards with prefixes and suffixes are allowed (https://prefix-*-suffix.hello.com) - A URL with a valid wildcard will not match a URL with more than one subdomain level in place of the wildcard. (https://*.hello.com will not work with https://sub1.sub2.hello.com) - Certain well-known shared hosting domains require a suffix or prefix for the wildcard (*.vercel.app is not allowed as this opens up anyone to authenticate on the Vercel platform, but *something.vercel.app is allowed as this will lock callbacks to your team or personal account). - Wildcards are not supported as part of a URL path (https://sub1.sub2.hello.com/* is not allowed). You can use the post-login redirect (available in several SDKs) to achieve dynamic navigation after authentication.Source: https://docs.kinde.com/get-started/connect/callback-urls/#wildcard-limitations In the code you shared, one of your URLs match a case that is not allowed https://*.vercel.app/api/auth/kinde_callback , I would suggest changing it what the highlighted line recommends.
8 replies
KKinde
•Created by Marcin on 3/25/2025 in #💻┃support
Kinde Auth Callback Issue on my domain
Potential root causes:
The error seems to stem from limitations of wildcards [1], combined with potential middleware conflicts and/or Vercel data state [2].
Have you checked the common issues with invalid callback URLs?
Troubleshoot ‘Invalid callback URL’ - A common error reported by new users is that they receive an ‘invalid callback URL’ message when testing their connection. If you get this error, check the following: - Make sure there are no spaces before or after the callback URL in your Kinde application. - Ensure the callback URL in your code exactly matches the callback URL in your Kinde application. - The Client ID in your code must exactly match the Client ID in your Kinde application. - If you’re testing with a cloud hosting solution, such as Vercel, redeploy your application each time you update the environment variables.Source: https://docs.kinde.com/get-started/connect/callback-urls/ One possible scenario is that you deployed the site, and updated certain environment variables later, which is generating this issue as the "updated" environment variables may be the correct ones. Have you tested that this does not work after you redeploy your Vercel app with the updated code that works in localhost and correct environment variables?
8 replies
KKinde
•Created by Marcin on 3/25/2025 in #💻┃support
Kinde Auth Callback Issue on my domain
Hello Marcin. Thank you for the detailed debugging summary—it’s very helpful.
Since:
- The flow works locally, and
- Authentication succeeds in production (despite the callback error),
This suggests:
- No code/flow issues (as you noted).
- Unlikely to be a URL mismatch (Kinde’s UI usually flags this explicitly).
8 replies