I’m trying to configure logic via magic link. I’ve successfully setup the passwordless connection and my custom email provider such that the emails are sent instantly, and I can trigger sending the email with the /passwordless/start endpoint of the Management API.
However, when I click the link, I’m redirected to a blank page showing the error:
Cannot read property 'toString' of undefined
From the logs in my dashboard, I can see that the login was successful, so it seems to be something with the auth0 library, as this error shows in my terminal:
HandlerError [TypeError]: Cannot read property 'toString' of undefined
at new HandlerError (.../node_modules/@auth0/nextjs-auth0/dist/utils/errors.js:53:28)
at Object.<anonymous> (.../node_modules/@auth0/nextjs-auth0/dist/handlers/callback.js:39:31)
at step (.../node_modules/tslib/tslib.js:143:27)
at Object.throw (.../node_modules/tslib/tslib.js:124:57)
at rejected (.../node_modules/tslib/tslib.js:115:69)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Also, when I redirect to my main page in my app, the user is not authenticated.
Could it be that the URL with a # instead of ? is causing it to not read the query params? This is where I get redirected after clicking the link I showed in my last post.
@dan.woda No that does not solve my problem. I already have that /api/auth/[...auth0].ts route configured and it’s working properly if I login using other means.
I cloned the source of the nextjs-auth0 package from GitHub and stepped through it manually. This is the line that’s returning undefined:
Actually, the more I look into this, I feel like at least partially to blame is that the params are being sent after the # in the URL and yet calling a server-side API route. Since these params are not being sent to the server, the callback isn’t able to process them correctly. Or am I misunderstanding how this feature is supposed to work? I’ve tried to follow all tutorials precisely, without making any changes to the defaults, but in the docs it just says that the magic link will work and redirect to the callback URL, without any more details about what the callback URL is expecting. Am I just redirecting to the wrong callback URL?