nabb23_
01/23/2023, 4:58 PMnabb23_
01/23/2023, 4:59 PMemailPasswordSignIn
throws an error. Unfortuately we do not have adequate logging here to know what the details of the error was, but we do know err.isSuperTokensGeneralError was false.
4. Within ThirdPartyEmailPassword.getRedirectionURL, context.action === 'SUCCESS', as we redirect to the OTP screen on this condition.
5. We then see /user/email/verify retrying indefinitely, and entering the OTP code and hitting submit has no effect.
6. Eventually we see a bunch of errors printed to the console:
Encountered an error while refreshing validator st-ev[object Response]
Uncaught (in promise): Error: No session exists
A couple of immediate questions that would be really helpful for us:
1. Broadly, any ideas here on where we should be looking to debug this further? We've taken a look at all the backend HTTP calls and a bunch of fe SDK code. Its obvious theres an error being throw here - https://github.com/supertokens/supertokens-website/blob/e7c136fbbb6a659e8cd2942486fcb9266064ad46/lib/ts/recipeImplementation.ts#L82 -, but without context its hard to tell what's going on in our case.
2. What does the SDK do in the background in between the /signin call, and firing of getRedirectionURL? It seems the error (which assumingly is triggering the indefinite reties) occurred somewhere in here.rp_st
01/23/2023, 5:03 PMrp_st
01/23/2023, 5:04 PMnabb23_
01/23/2023, 5:10 PM{
"content-type": "application/json",
"fdi-version": "1.15",
"rid": "emailverification"
}
Response Headers:
{
"content-length": "33",
"content-type": "application/json; charset=utf-8",
"front-token": "<redacting, but present>"
}
Response Body:
{
"status": "OK",
"isVerified": true
}
Status: 200
As far as SDK - "supertokens-auth-react": "^0.26.4",
We are using mostly a custom UI.rp_st
01/23/2023, 5:11 PMrp_st
01/23/2023, 5:14 PMnabb23_
01/23/2023, 5:19 PMrp_st
01/23/2023, 5:20 PMrp_st
01/23/2023, 5:21 PMrp_st
01/23/2023, 5:22 PMrp_st
01/23/2023, 5:23 PMnabb23_
01/23/2023, 5:35 PMdisableDefaultUI: false,
override: {
components: {
EmailVerificationSendVerifyEmail_Override: (props) => {
return <EmailVerify {...props} />
},
EmailVerificationVerifyEmailLinkClicked_Override: ({ DefaultComponent, ...props }) => {
return <EmailVerifyClicked {...props} />
},
},
},
We don't have the value of the access token, but sending you the front token that comes back from that APIrp_st
01/23/2023, 5:40 PMrp_st
01/23/2023, 5:42 PMrp_st
01/23/2023, 5:59 PM<EmailVerify />
component might be constantly remounting.rp_st
01/23/2023, 6:01 PM<EmailVerify />
component), is also remounting and that component calls the email verify GET API.
So any reasons that might be causing remounts?zachequi
01/23/2023, 6:24 PMzachequi
01/23/2023, 6:24 PMrp_st
01/23/2023, 6:29 PMif (tokenInfo.ate < Date.now()) {
is true, it would mean that you would see calls to the refresh API as well.rp_st
01/23/2023, 6:31 PMnabb23_
01/23/2023, 6:32 PMzachequi
01/23/2023, 6:32 PMrp_st
01/23/2023, 6:32 PMzachequi
01/23/2023, 6:32 PMrp_st
01/23/2023, 6:34 PMmaxAgeInSeconds
to a larger number than 5 mins.
I'll share some code shortly.zachequi
01/23/2023, 6:35 PMrp_st
01/23/2023, 6:36 PMmaxAgeInSeconds
time has passed.
> Are there industry best practices here for doing any kind of calculation on the user's machine to figure out how accurate it is and calibrating? Or anyway to make it so we're immune to user clock skew?
Will get back on this.rp_st
01/23/2023, 6:38 PMrp_st
01/23/2023, 6:39 PMmaxAgeInSeconds
to make it 10 mins instead of 5 mins. Making this an even more rare edge case. That is until we can implement the skew check logic.rp_st
01/23/2023, 6:58 PMts
import EmailVerification from "supertokens-auth-react/recipe/emailverification";
import Session from "supertokens-auth-react/recipe/session";
Session.init({
override: {
functions: (oI) => {
return {
...oI,
getGlobalClaimValidators: function (input) {
// we remove the default claim validator which has maxAgeInSeconds as 5 mins
input.claimValidatorsAddedByOtherRecipes = input.claimValidatorsAddedByOtherRecipes.filter(c => c.id !== EmailVerification.EmailVerificationClaim.id);
// then we re add it with 10 as the max age in secs
input.claimValidatorsAddedByOtherRecipes = [...input.claimValidatorsAddedByOtherRecipes, (EmailVerification.EmailVerificationClaim.validators as any).isVerified(10, 600)]
return input.claimValidatorsAddedByOtherRecipes;
}
}
}
}
})
In .isVerified(10, 600)
, the 10
represents the minimum number of seconds to wait for before querying the is email verification API if the email is NOT verified, whereas 600
is the min number of seconds to wait for if the email is verified. The default values in our SDKs are (10, 300)
.zachequi
01/23/2023, 8:52 PMnabb23_
01/24/2023, 2:44 PMrp_st
01/24/2023, 2:45 PMSuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).
Powered by