Wondering if I might have some help - I am impleme...
# support-questions-legacy
b
Wondering if I might have some help - I am implementing a custom UI following the docs for magic link. For some reason, the consume endpoint is being called twice in quick succession, and I have no idea why that would be.
Copy code
[06:04:29.440] INFO: incoming request

reqId: "req-6"

req: {

"method": "POST",

"url": "/api/auth/signinup/code/consume",

"hostname": "<URL>.railway.app",

"remoteAddress": "192.168.0.4",

"remotePort": 42904

}

[06:04:29.494] INFO: incoming request

reqId: "req-7"

req: {

"method": "POST",

"url": "/api/auth/signinup/code/consume",

"hostname": "<URL>.railway.app",

"remoteAddress": "192.168.0.3",

"remotePort": 52334

}
I am using React, but following using hte supertokens-web-js, maybe this is part of my mistake? I just wasn't sure how to implement the react version with my own UI. Code:
Copy code
typescript
export const handleMagicLinkClicked = async () => {
  try {
    const response = await consumePasswordlessCode();

    if (response.status === 'OK') {
      await clearPasswordlessLoginAttemptInfo();
      if (
        response.createdNewRecipeUser &&
        response.user.loginMethods.length === 1
      ) {
        toast.success('Account created successfully. Welcome!');
      } else {
        toast.success('Login successful. Welcome back!');
      }

      return 'success';
    } else {
      await clearPasswordlessLoginAttemptInfo();
      toast.error('Login failed. Please try again');
      return 'failed';
    }
  } catch (error: unknown) {
    if (isSuperTokensError(error)) {
      toast.error(error.message);
    } else {
      toast.error('Something went wrong');
      return 'error';
    }
  }
};
Any help would be appreciated. I am very stumped
2 Views