-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convex Auth consumes pages that have "code" as search param #145
Comments
Sounds like we should be using state= param to the auth request to GitHub, etc. Looking into this now. |
Today the Convex Auth middleware sees the I wonder if we can use a more specific query parameter than I need to confirm this, there are other flows but they might all be able to use a different name. If this doesn't work, we could register certain routes and not oauth-redirectable-to and those routes don't slurp up ?code= |
Oh, that's good news then @thomasballinger. For now, I have a simple hack that is working well by rewriting the search param in Trying to do this in the most TanStacky way (vs brute-forcing the param change in the URL): export const Route = createFileRoute("/_authenticated/integrations/mailchimp")({
beforeLoad: ({ search }) => {
if (search.code) {
const mailchimpCode = search.code;
delete search.code;
throw redirect({
to: "/integrations/mailchimp",
search: {
...search,
mailchimpCode,
},
});
}
},
component: MailchimpComponent,
validateSearch: (search: Record<string, unknown>): MailchimpSearch => {
return {
code: (search.code as string) || undefined,
mailchimpCode: (search.mailchimpCode as string) || undefined,
};
},
}); |
After some investigation here, the name of the The most pragmatic thing seems to be a list of URL patterns to ignore or a callback to examine the request in middleware to know to skip it. This would be a change to middleware, a callback or pattern you pass in that returns true or matches when the Any design thoughts welcome, I'm going to hit some more urgent auth things first but if this blocking anyone else please let me know and we can reprioritize. |
I don't think this is true -- we're just hardcoding that the parameter is named So an alternative option here would be allowing the name of the query param to be customizable (but still intercepting the query param on every request). But I think it might be more straightforward to allow configuring which routes should expect a |
Came across this curious case recently:
After some head scratching, I realized my ConvexAuthProvider was snatching up the
?code=12345
portion of my URL, attempting to authenticate it as if it were a sanctioned auth provider, failing, clearing my locally stored auth tokens, ultimately leaving me in a logged-out state.Unfortunately this all happens prior to my /integrations/mailchimp/connect page loading, so I can't "block" it there, or do anything in that place.
I'm sure I can find a workaround, but it'd be great to somehow (not sure how!) tell Convex Auth not to worry about this
?code
, I got it.The text was updated successfully, but these errors were encountered: