Guys I am facing an issue while fetching a user through email. The auth dashboard shows the user is signedUp and Auth method under Email password. If there is any other method to go through forgot password flow.
In the current flow from frontend it sends a token, so it does not verify if a user is already present in the database. It just sends out the email to whatever email you provide.
Frontend is used for thirdparty
Following is config file
import ThirdPartyEmailPassword from "supertokens-node/recipe/thirdpartyemailpassword";
export function getApiDomain() {
const apiPort = process.env.REACT_APP_API_PORT || 4001;
const apiUrl = process.env.REACT_APP_API_URL || `http://localhost:${apiPort}`;
return apiUrl;
}
export function getWebsiteDomain() {
const websitePort = process.env.REACT_APP_WEBSITE_PORT || 3000;
const websiteUrl =
process.env.REACT_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
}
export const SuperTokensConfig: TypeInput = {
supertokens: {
connectionURI: "localhost:3567",
},
appInfo: {
appName: "Auth Middleware Express",
apiDomain: getApiDomain(),
websiteDomain: getWebsiteDomain(),
},
recipeList: [
ThirdPartyEmailPassword.init({
providers: [
// Google({
// clientId:"ID",
// clientSecret: "SECRET",
// }),
],
}),
Session.init({}),
Dashboard.init(),
UserMetadata.init(),
],
};
Following is my controller file
import {
getUsersByEmail
} from "supertokens-node/recipe/thirdpartyemailpassword";
export const createTokenForResetPassword = async (req: any, res: any) => {
const { email } = req.body;
try {
const getUser = await getUserByEmail(email);
console.log("EMAIL ", email);
console.log("USER ",getUser);
// const createVeriToken = await createResetPasswordToken(getUser.userId);
res.send({ status: "OK" });
}
catch (err) {
res.status(500)
}
};