"Hello, I am currently implementing the SuperToke...
# general
m
"Hello, I am currently implementing the SuperTokens passwordless recipe in a ReactJS application with Redux Toolkit. My code, which handles OTP submission, works perfectly in my local development environment. However, when I deploy the same code to my production environment, I encounter the following error: error from otp submit ====== TypeError: Cannot use 'in' operator to search for 'loginMethods' in undefined at l (main.js:2:3254333) at t.normaliseUserResponse (main.js:2:3256743) at Object. (main.js:2:3231054) at main.js:2:3228544 at Object.next (main.js:2:3228649) at a (main.js:2:3227363) import { createCode, resendCode, consumeCode,} from "supertokens-web-js/recipe/passwordless"; i am using above library It's worth noting that my code does not make any reference to 'loginMethods,' and this issue only arises in the production environment. I have compared the configurations between my local and production environments, and they seem consistent. Additionally, I have reviewed the SuperTokens documentation and have not found any references to 'loginMethods' in my code. Could you please assist me in identifying the root cause of this error and provide guidance on how to resolve it? Thank you for your help.
r
Hey. Which version of the node SDK are you running?
m
supertokens-web-js@0.7.3
r
Which node SDK??
Not frontend.. but nose SDK
m
sry i am not getting for backend i am using supertokens-python==0.14.8 my node version is v18.17.1
r
Right ok. Ur your are using python
m
yes
which version should i use ?
r
you should use web-js version ^0.6.0
m
ok thank you
r
@porcellus here
@Manoj G whats the response from the consume code call?
the response body
you can find the response in the network tab
m
in network tab i am getting correct response
in nerwork i am getting this reponse { "status": "OK", "created_new_user": false, "user_id": "22c1c893-d6ab-45eb-8697-9d47bd412a5c", "phone_number": null, "email": "manoj98achar@gmail.com", "name": null, "role": [ "employer-onboarding" ], "login_as": "employer", "internal_interviewers": false, "internal_recruiters": false }
r
Have you modified the response in the backend override?
m
Actually i am not modify any response but i am overriding the request preAPIHook: async (context) => { let action = context.action; if (action === "PASSWORDLESS_CONSUME_CODE") { let requestBody = JSON.parse(context.requestInit.body); let url = context.url; let requestInit = context.requestInit; requestBody.role = "admin", return { url, requestInit }; } },
thank you now it is working
Hi, In Supertoken, I am using a passwordless recipe. Is it possible to add custom data to the session through the front end? If so, how can this be done? i am using import Session from "supertokens-web-js/recipe/session";
r
you can't add data to the session via the frontend. You can only do that via the backend.
10 Views