You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a middleware using withAuthMiddleware that redirects the user to the homepage with a custom Search param and seems to not be supported because I get to this broken link: http://localhost:3000/%3Ferror=notAuthorized?redirectedFrom=%2Fprotected%2Fpage
Debugging the code, I found the part below where we can see that the redirectTo is set as pathname and then a SearchParam is set. This is the part that could be more flexible.
I have a
middleware
usingwithAuthMiddleware
that redirects the user to the homepage with a custom Search param and seems to not be supported because I get to this broken link:http://localhost:3000/%3Ferror=notAuthorized?redirectedFrom=%2Fprotected%2Fpage
My code
Debugging the code, I found the part below where we can see that the
redirectTo
is set aspathname
and then a SearchParam is set. This is the part that could be more flexible.https://github.com/supabase-community/auth-helpers/blob/9b4225133a5f3a617819570bd172af3cdb8ac7cb/packages/nextjs/src/middleware/withMiddlewareAuth.ts#L142-L159
Proposal
What if we check that the redirectTo is an instanceof URL (https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) and eventually avoiding setting it to the pathname but using that to set the SearchParam?
Or eventually an additional check should be done to initialize the given URL string
The text was updated successfully, but these errors were encountered: