In my use case, not sensitive information is generated before the user signs up, I want to be able to use oauth and tie this information after the signup flow.
When I use the signIn function with the google provider, I want to pass data through search parameters in the callbackUrl, I am able to get it on localhost, but when I deploy on Vercel it does not work, the google provider simply redirects to my home page.
...
signIn('google', {
callbackUrl: MY_ROUTES.linkNewUser.path + "?someData=12345",
});
...
...
const someData = searchParams.someData;
...
As stated in the Google docs for Oauth it is not possible to use a fragment (search parameters) in the redirect_uri.
Since it is more tolerant with urls matching "localhost", it will work in a dev environment but not on production.
To be able to achieve my goal I simply saved a cookie before the signup flow, and retrieved it afterwards. There are many strategies to achieve this goal, and to set and get cookies, I won't cover them here.