n000dles
11/01/2022, 10:37 AMnkshah2
11/01/2022, 10:38 AMnkshah2
11/01/2022, 10:38 AMn000dles
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 innkshah2
11/01/2022, 10:42 AMEmailPassword.getUserByEmail
to get the user id with that email if you use the user id in your databasenkshah2
11/01/2022, 10:43 AMrefreshPOST
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/usagen000dles
11/01/2022, 11:31 AMrp_st
11/01/2022, 11:38 AMawait session.revokeSession
before returning the response from the overriden000dles
11/01/2022, 12:44 PMrp_st
11/01/2022, 12:52 PMn000dles
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_st
11/01/2022, 1:08 PMrp_st
11/01/2022, 1:08 PMn000dles
11/01/2022, 1:34 PMn000dles
11/01/2022, 1:34 PMn000dles
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);
}
}
n000dles
11/01/2022, 1:34 PMrp_st
11/01/2022, 1:44 PMrp_st
11/01/2022, 1:45 PMn000dles
11/01/2022, 1:51 PMrp_st
11/01/2022, 1:53 PMrp_st
11/01/2022, 1:53 PMrp_st
11/01/2022, 1:53 PMn000dles
11/01/2022, 1:53 PMn000dles
11/01/2022, 1:56 PMrp_st
11/01/2022, 1:56 PMrp_st
11/01/2022, 1:56 PMrp_st
11/01/2022, 1:56 PMrp_st
11/01/2022, 1:56 PMrp_st
11/01/2022, 1:57 PMrp_st
11/01/2022, 1:57 PMn000dles
11/01/2022, 1:58 PMn000dles
11/01/2022, 1:58 PMrp_st
11/01/2022, 1:59 PMrp_st
11/01/2022, 1:59 PMn000dles
11/01/2022, 2:01 PMn000dles
11/01/2022, 2:01 PMrp_st
11/01/2022, 2:03 PMn000dles
11/01/2022, 2:05 PMrp_st
11/01/2022, 2:05 PMrp_st
11/01/2022, 2:06 PMn000dles
11/01/2022, 2:08 PMrp_st
11/01/2022, 2:08 PMrp_st
11/01/2022, 2:09 PMawait response.revokeSession(userid);
line should change to await response.revokeSession();
Cause the response
is the session objectn000dles
11/01/2022, 2:12 PMn000dles
11/01/2022, 2:13 PMrp_st
11/01/2022, 2:18 PMrp_st
11/01/2022, 2:26 PMrp_st
11/02/2022, 12:09 PMn000dles
11/03/2022, 4:03 AMrp_st
11/03/2022, 4:11 AM