A practical guide to configuring Auth0 with Next.js 13 (App Router) for multi-tenant applications using subdomains. Covers the specific issues encountered with callback URLs, grant_type errors, and logout loops. The solution involves creating a custom Auth0 SDK initialization that dynamically sets the baseURL and session cookie domain from the request host header, and fixing a cookie conflict caused by the withMiddlewareAuthRequired middleware creating a duplicate domain cookie that prevents logout from working correctly.
Sort: