custom attribute for passwordless


04/04/2023, 11:34 AM
I'm using passwordless recipe. I want to send some extra info say 'student' or 'teacher' from frontend 'reactjs' to backend 'python django' so that in backend i can assign that user respective role. I tried using 'InputSignUpFeature' of emailpassword recipe in passwordless recipe but it didn't support. I want to send some signal who is signup to backend
You can do this by using our pre API hook feature of the frontend SDK to add custom attributes to the request body. You can then access the request object via the user context on the backend's createCode API to read this custom attribute and save it (in your db) against the preAuthSessionId created by the originalImplementation of createCode. Finally, in the consumeCode API on the backend, you will have the same preAuthSessionId using which you can fetch the custom attribute and then you will know if the user who just signed up is a teacher or a student.