NextAuth – Catch callback url from OAuth

I have this NextAuth config in Nextjs project

import NextAuth, { AuthOptions } from 'next-auth';

export const authOptions: AuthOptions = {
  providers: [
    {
      id: 'xxxSSO',
      name: 'xxxSSO',
      type: 'oauth',
      clientId: 'abcdef',
      authorization: {
        url: 'https://xxx/auth/openid-connect/auth',
        params: {
          response_type: 'code',
          scope: 'profile email',
          redirect_uri: 'http://localhost:3002/auth/signin-oauth',
        },
      },
      profile() {
        return {
          id: '',
          name: '',
          email: '',
          image: '',
        };
      },
    },
  ],
};

export default NextAuth(authOptions);

First fetch works well but the redirect url is like this:
http://localhost:3002/auth/signin-oauth?state=ssQ8yxxxxx_pjE46_ajRsR_xxxxFipU&session_state=xxxxx-xxxx-xxxx-af34-f765ff80583f&code=xxxxxx-160e-xxx-b373-00b0f32a126d.xxxx

This leads to a 404 | Not Found page.

My question is, where do I config it to catch the code in that url and continue the auth flow?

The redirect_uri is fixed on the auth server, so It cannot be changed.

I have try to use callback and custom token config, doesn’t work or I might miss something important, please help!