rp
05/03/2022, 5:31 PMΛ C Ξ L X R D
05/03/2022, 11:10 PMΛ C Ξ L X R D
05/03/2022, 11:10 PMjs
import "https://cdn.jsdelivr.net/gh/supertokens/supertokens-website/bundle/bundle.js"
supertokens.init(
{
apiDomain: "http://localhost:8000",
apiBasePath: "/auth",
onHandleEvent: (context) => {
if (context.action === "UNAUTHORISED") {
// called when the user doesn't have a valid session but made a request that requires one
// NOTE: This event can fire multiple times
if (context.sessionExpiredOrRevoked) {
// the sessionExpiredOrRevoked property is set to true if the current call cleared the session from storage
// this happens only once, even if multiple tabs sharing the same session are open, making it useful for analytics purposes
fetch("auth/session/refresh", {method: "POST"}).then(r =>{
if (r.status === 200) {
console.log("Session refreshed")
} else {
console.log("Session refresh failed")
}
})
}
}
}
});
Λ C Ξ L X R D
05/03/2022, 11:10 PMInfatuation
05/04/2022, 12:15 AMrp
05/04/2022, 4:31 AMKalibCheil
05/04/2022, 8:31 PMmarshmalon
05/04/2022, 8:37 PMmarshmalon
05/04/2022, 8:37 PMsolminded
05/04/2022, 9:58 PM/api/auth/signinup
POST? I was not able to find any documentation or examples at Supertokens repo about it. I keep getting FIELD_ERROR but no other message is available looking at the backend response.marshmalon
05/04/2022, 10:53 PMTryRefreshToken
error.
I am trying to see if I can log more information about the session using a test route that has session_required=True
but still not sure why that disparity would exist.
This error suddenly manifested after switching our domain to start using wwwnkshah2
05/05/2022, 3:18 AMnkshah2
05/05/2022, 3:24 AMnkshah2
05/05/2022, 3:28 AMaminoxix 🇮🇳
05/05/2022, 7:46 AMPitchAsh
05/05/2022, 11:55 AMPitchAsh
05/05/2022, 5:27 PM[Manicraft1001]
05/05/2022, 6:26 PMΛ C Ξ L X R D
05/05/2022, 8:55 PMrp
05/06/2022, 4:27 AMmogalmahesh
05/06/2022, 2:06 PMXxX_MLG Noob_XxX
05/06/2022, 5:15 PM/auth/signout
. Getting unauthorized errors. How exactly does that happen? 🤔rp
05/06/2022, 7:03 PMexecreate
05/07/2022, 5:47 AMpython
CSRF_TRUSTED_ORIGINS=[domain_names]
CSRF_COOKIE_SECURE = True
The issue we are getting is that POST requests we are getting this response:
json
{
"detail": "CSRF Failed: CSRF token missing."
}
funk101
05/07/2022, 1:21 PMPOST http://localhost:3000/api/auth/signup 400 (Bad Request)
funk101
05/07/2022, 1:22 PMrecipeList: [
EmailPasswordNode.init({
signUpFeature: {
formFields: [
{
id: "firstname",
},
{
id: "lastname",
},
],
},
override: {
apis: (originalImplementation) => {
return {
...originalImplementation,
signUpPOST: async function (input) {
if (originalImplementation.signUpPOST === undefined) {
throw Error("Shouldn't come here");
}
try {
const response = await originalImplementation.signUpPOST(
input
);
console.log("Response: ", response);
if (response.status === "OK") {
const formFields = input.formFields;
console.log("FormFields: ", formFields);
}
} catch (err) {
console.log("Error: ", err.message);
}
return response;
},
};
},
},
}),
SessionNode.init(),
],
isInServerlessEnv: true,
rp
05/08/2022, 4:43 AMnadilas
05/08/2022, 12:35 PMexport interface ThirdPartySignInUpPOSTInput {
provider: TypeProvider;
code: string;
redirectURI: string;
authCodeResponse?: any;
clientId?: string;
options: ThirdPartyAPIOptions;
userContext: any;
}
rp
05/08/2022, 12:48 PMnadilas
05/08/2022, 1:20 PMnadilas
05/08/2022, 1:20 PM