Magic login link callback redirect is not working

Hi,

I built a Nextjs project named vocab builder at link https://vocab-builder.app. My tech stack are Nextjs, Authjs(v5), Resend. I set up the login callback redirect to be my home page:

signIn(‘resend’, { email: result.data.email, redirect: false, redirectTo: ‘/’ });

I also added two required environment variables:

AUTH_URL=https://vocab-builder.app
AUTH_TRUST_HOST=TRUE

Running local build, I get expected result with the url being http://localhost:3000/ of some sort. But when I try login my deployed project, I do end up on my home page, but the url is the login url as is, like this one:

Intro | Vocab Builder

Is it possible for it to be as clean as the local build result?

I also attached a pic of the login email for reference.

Thanks.

You’ll have to use an Edge Function to remove the params. Something like:

import type { Config, Context } from '@netlify/edge-functions'

export default async function(_: Request, context: Context) {
  if (context.url.searchParams.get('callbackUrl')) {
    return new Response('', {
      headers: {
        location: '/'
      },
      status: 301
    })
  }
}

export const config: Config = {
  path: '/'
}

Thanks for your help. While trying to apply your suggestion, I ran into another issue with the auth cycle: when logging out, the session cookie isn’t cleared automatically, which causes the user to be logged in again after refreshing the page. I’m pretty tired and don’t want to keep chasing these issues — and possibly more to come — so I decided to deploy to Vercel instead. Everything works perfectly there, no issues at all. You can try it yourself at https://vocab-builder-v2.vercel.app/. I’ll keep the app on Netlify for a few more days in case you want to take a closer look.

Also the git repo: GitHub - OahMada/vocab-builder-v2

The second issue is same as: Next Auth session not clearing - #8 by hrishikesh

I accidentally created a Netlify account using GitHub with the same email as my Google account. Now neither login method is working. I get the error: “We already have a registered user with this email address.”
Please unlink or reset my account access.

https://netlify.zendesk.com/agent/tickets/431971

Hey @Fahadali :wave:,
Thanks for reaching out!

We’ve gone ahead and created a support ticket for you, so our team can follow up with you directly via email from the help desk. Our Support crew will be in touch with you by email soon.

Great news: these days anyone can reach out to Netlify Support. First, you can try getting an answer using Ask Netlify, our helpful AI search tool. If your question isn’t answered there, you can submit a ticket using the support form, and we’ll take it from there.

We’re keeping the community around for swapping ideas, sharing tips and tricks, and talking shop with other folks building on the platform — but for support issues, tickets are the way to go.

Thanks for being here, and keep an eye out for that email from us!