flyingfoxuk
01/09/2023, 8:54 AMsendEmail fn to redirect to /auth/verify on my API (not the frontend) so that a very basic (non-SPA) HTML page is served to conduct the consumeCode and validate the login, but of course the cookies end up on that device (eg. a phone browser). What is the best way to poll for the original login request on the original device and to then have the cookies for the authentication tokens sent to the original SPA, as if the consumeCode fn was called on the original browser?
I'm thinking to use consumeCodePOST to mark my own DB with the user/preAuthSessionId as logged in, and have the original SPA poll my endpoint for validating that, but then how do I get supertokens to send the token data to the SPA in order that the user can become validated on that device? Many thanks for any advice.rp_st
01/09/2023, 11:10 AMrp_st
01/09/2023, 11:10 AMporcellus
01/09/2023, 11:12 AMporcellus
01/09/2023, 11:13 AMcreateNewSession in the polling endpointflyingfoxuk
01/09/2023, 11:14 AMporcellus
01/09/2023, 11:14 AMporcellus
01/09/2023, 11:15 AMflyingfoxuk
01/09/2023, 11:16 AMpreAuthSessionId from the createCodePOST override so I can enter that in my DB against the submitted email ?rp_st
01/09/2023, 11:24 AMporcellus
01/09/2023, 11:24 AMporcellus
01/09/2023, 11:25 AMporcellus
01/09/2023, 11:27 AMcreateCodePOST should contain the preAuthSessionIdporcellus
01/09/2023, 11:31 AMcreateCodePOSTporcellus
01/09/2023, 11:32 AMconsumeCodePOST that saves the userId into your DB keyed with the preAuthSessionIdporcellus
01/09/2023, 11:34 AMpreAuthSessionId. If it exists you can create a new session and remove the record from your DBflyingfoxuk
01/09/2023, 11:35 AMporcellus
01/09/2023, 11:41 AMporcellus
01/09/2023, 11:44 AMconsumeCode and the polling endpoint instead of the user.