Noodles
11/01/2022, 10:37 AMnkshah2
11/01/2022, 10:38 AMNoodles
11/01/2022, 10:39 AMemailpassword
recipenkshah2
11/01/2022, 10:40 AMsignInPost
API which receives an email as an input which you can use to determine if the user should be allowed to sign inEmailPassword.getUserByEmail
to get the user id with that email if you use the user id in your databaserefreshPOST
API of the Session recipe to check if user is banned and not refresh the session in that case https://supertokens.com/docs/session/advanced-customizations/apis-override/usageNoodles
11/01/2022, 11:31 AMrp
11/01/2022, 11:38 AMawait session.revokeSession
before returning the response from the overrideNoodles
11/01/2022, 12:44 PMrp
11/01/2022, 12:52 PMNoodles
11/01/2022, 1:08 PMSessionNode.init({
override: {
apis: (originalImplementation) => {
return {
...originalImplementation,
refreshPOST: async function (input) {
if (originalImplementation.refreshPOST === undefined) {
throw Error("Should never come here")
}
let response = await originalImplementation.refreshPOST(input);
const banned = true;
if (banned) {
let userid = response.getUserId();
await response.revokeSession(userid);
}
return response;
},
}
}
}
}),
not sure if it's correct, but happy for correctionsrp
11/01/2022, 1:08 PMNoodles
11/01/2022, 1:34 PMasync function handleUser() {
try {
if (await Session.doesSessionExist()) {
let validationErrors = await Session.validateClaims();
if (validationErrors.length === 0) {
setUser(true);
} else {
setUser(false);
Router.push("/auth/login?promptVerifyEmail=true");
}
} else {
Router.push(
`/auth/login?onLoginRedirectTo=` + window.location.pathname
);
}
} catch (err) {
alert(err);
}
}
rp
11/01/2022, 1:44 PMNoodles
11/01/2022, 1:53 PMrp
11/01/2022, 1:56 PMNoodles
11/01/2022, 1:58 PMrp
11/01/2022, 1:59 PMNoodles
11/01/2022, 2:01 PMrp
11/01/2022, 2:03 PMNoodles
11/01/2022, 2:05 PMrp
11/01/2022, 2:05 PMNoodles
11/01/2022, 2:08 PMrp
11/01/2022, 2:08 PMawait response.revokeSession(userid);
line should change to await response.revokeSession();
Cause the response
is the session objectNoodles
11/01/2022, 2:12 PMrp
11/01/2022, 2:18 PMNoodles
11/03/2022, 4:03 AMrp
11/03/2022, 4:11 AM