Promise not resolving in custom login

Question:
getting oauth flow timed out and promise not resolving when calling getMemberTokenForDirectLogin function of wix sdk

Product:
wix headless ecom along with next js

What are you trying to achieve:
i have a custom login page which uses wix headless wixclient.auth.login function to login user and when user logs in i get a response with login status and session token if successfull. now we need to extract this token for further processing by using getMemberTokenForDirectLogin but that is not resolving. it is a promise that never resolves and eventually gets timed out rest all is working fine and my process get stuck at this point
What have you already tried:
i tried not awaiting the function getMemberTokenForDirectLogin then it returned me a promise but if i await it it never gets resolved

Additional information:
“use client”;

import { FormField } from “…/…/types”;
import ReusableForm from “./ReusableForm”;
import Link from “next/link”;
import { login } from “@/app/api/auth”;
import { useWixClient } from “@/hooks/useWixClient”;
import { useRouter } from “next/navigation”;
import { LoginState } from “@wix/sdk”;
import Cookies from “js-cookie”;
import { loginSchema } from “@/lib/validations/auth”;
import { useToast } from “@/hooks/use-toast”;

const formFields: FormField = [
{
label: “Email ID”,
name: “email”,
type: “email”,
placeholder: “johndoe@gmail.com”,
},
{
label: “Password”,
name: “password”,
type: “password”,
placeholder: “johndoe@gmail.com”,
},
];

const LoginForm = () => {
const wixClient = useWixClient();
const router = useRouter();
const { toast } = useToast();

const handleSubmit = async (values: { [key: string]: string }) => {
const validatedFields = loginSchema.safeParse(values);

if (!validatedFields.success) {
  throw validatedFields.error;
}

try {
  console.log("logging in");
  const res = await wixClient.auth.login({
    email: validatedFields.data.email,
    password: validatedFields.data.password,
  });
  if (res.loginState === LoginState.FAILURE) {
    throw new Error("Invalid email or password");
  }

  if (res.loginState === LoginState.SUCCESS) {
    console.log("log in success");
    const sessionToken = res.data.sessionToken;
    const tokens = await wixClient.auth.getMemberTokensForDirectLogin(
      sessionToken
    );
    console.log("tokens", tokens);
    // wixClient.auth.setTokens(tokens);
    // Cookies.set("wix_auth", JSON.stringify(tokens), { expires: 7 });

    // Add success toast
    toast({
      title: "Success!",
      description: "You've successfully logged in. Welcome back!",
      variant: "default",
    });

    router.push("/");
  }
} catch (error) {
  throw error;
}

};

return (


{LOGIN YOUR ACCOUNT}





Forgot Password ?



);
};

export default LoginForm;
this is my code block

I have tried running it server side but it requires window and every configuration of wix sdk is perfectly fine i have already checked it multiple time. I even cloned the repo of the tutorial i was following and got same issue in that also. The issue is from wix side i am guessing.

I tried connecting through discord but there is no answer from them. Cant find any other way to connect to them. Maybe because it js holiday season but i am stuck because of error and this thing is urgent for me

Yes sure, it would be really helpful if you can connect me with them

guptakeyur3@gmail.com