EdwinN1337
06/29/2022, 9:13 AMjs
supertokens.init({
...frontendConfig().appInfo,
cookieHandler: capacitorCookieHandler,
})
We are following this guide now, since our implementation didn't work as expected (due to lax cookies & safari webkit issue):
https://supertokens.com/docs/thirdpartyemailpassword/advanced-customizations/examples/localstorage/aboutPPaii
06/29/2022, 1:43 PMPPaii
06/29/2022, 2:15 PMrp
06/29/2022, 2:28 PMCaptainPhoton
06/29/2022, 5:48 PMlocation /api {
try_files $uri @api;
}
The gateway path should be /api and the api path should be just /auth?pruthvi
06/30/2022, 1:38 AMrp
06/30/2022, 2:03 AMPPaii
06/30/2022, 3:36 AMDupelet
06/30/2022, 2:06 PMsegidev
06/30/2022, 2:29 PMCaptainPhoton
06/30/2022, 5:47 PMrp
06/30/2022, 5:48 PMCaptainPhoton
06/30/2022, 5:48 PMCaptainPhoton
06/30/2022, 5:56 PMconsumeCode: async function (input) {
let { deviceId, preAuthSessionId, userInputCode } = input;
let user = getUserSomehow(deviceId, preAuthSessionId, or userInputCode);
console.log(user);
/*if (email) {
await preventUserSignUpIfTheyAlreadyExist(email);
}*/
return originalImplementation.consumeCode(input);
}
Do I need to put it in userContext? If so, where do I do that?TJ Biegner
06/30/2022, 9:28 PMTJ Biegner
06/30/2022, 9:30 PMfunc updateSessionWithResults(w http.ResponseWriter, r *http.Request, results *models.Profile) error {
sessionContainer := session.GetSessionFromRequestContext(r.Context())
currAccessTokenPayload := sessionContainer.GetAccessTokenPayload()
currAccessTokenPayload["profile"] = results
log.Println(results)
err := sessionContainer.UpdateAccessTokenPayload(currAccessTokenPayload)
if err != nil {
err = supertokens.ErrorHandler(err, r, w)
if err != nil {
return err
}
}
return nil
}
TJ Biegner
06/30/2022, 9:32 PMAccess-Control-Expose-Headers: front-token
...
Set-Cookie: sAccessToken=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsInZlcnNpb24iOiIyIn0%3D.eyJzZXNzaW9uSGFuZGxlIjoiYmZmYzMwOTgtY2M3MC00NDM4LWEzOG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h5289%2Bo4kftOwWFN9hynN84IrLQtaUV2Rrm%2F50e86EoeYzDMJogIcJnKZPsUYz%2FV5OKXTM8d4%2Fx2lD15supJVJzkRgsK4pZKKsWX9Jh8Sdc%2FNFC0KaKIGUNasw%3D%3D; Path=/; Expires=Thu, 30 Jun 2022 22:29:35 GMT; HttpOnly; SameSite=Lax
note the expires time was the same as the responserp
07/01/2022, 4:09 AMBeeMoe
07/01/2022, 4:41 AMDupelet
07/01/2022, 7:51 AMconstantinos
07/01/2022, 3:22 PMhenryholtgeerts
07/01/2022, 4:20 PMAlankazam
07/01/2022, 5:29 PMsegidev
07/01/2022, 6:31 PMemailpassword_users
, etc...
I am asking because i use goent and i successfully can relate to the emailpassword_users
table. The problem is on the first start if the database does not exist entgo Migrations fail because the table `emailpassword_users`does not exist at that point.
My code looks like this
go
func DefineRoutes() *gin.Engine {
supertokens.Init()
// Adding the SuperTokens middleware in this function as well
app, v1 := gnshttp.GetGinApp("v1")
// Fails with: failed creating schema resources: sql/schema: create "user_profiles" table: pq: relation "emailpassword_users" does not exist
ent.Schema.Create(...)
...
}
As you can see I am initializing SuperTokens first, but that does not helpCaptainPhoton
07/02/2022, 7:08 AMwdjzr
07/02/2022, 5:58 PMwdjzr
07/02/2022, 5:58 PMBeeMoe
07/03/2022, 2:38 AMPPaii
07/03/2022, 2:52 AM