I'm trying to add email verification as documented here: https://supertokens.com/docs/emailpassword/...
j
I'm trying to add email verification as documented here: https://supertokens.com/docs/emailpassword/common-customizations/email-verification/about However I get the following error:
Copy code
Argument of type '{ mode: string; }' is not assignable to parameter of type 'TypeInput'.
r
Hey
j
hey 😄
I'm back with more silly questions 😉
r
What’s the import statement? Also are you using the latest version of the SDKs?
j
Copy code
import EmailVerification from "supertokens-node/recipe/emailverification";
is it a new feature? I have not updated the sdk since I started using it a couple of months back
r
Oh yea. New indeed
If you are updating it, I recommend you see the Changelog
j
do you have. a link?
And also see the front end SDK Changelog
j
updating got rid of the error
I have some trouble front-end now after updating to 0.26.4
Copy code
Type '(context: GetRedirectionURLContext) => void' is not assignable to type '(context: GetRedirectionURLContext) => Promise<string | undefined>'.
  Type 'void' is not assignable to type 'Promise<string | undefined>'`
I don't have to update a typescript @types package right?
r
You don’t have to update any types. It’s all part of the SDK
j
alright
i'm trying to follow the migration step found in the changelog
r
You should just return undefined at the end of the function instead of having no return
I think that will solve the issue. But not too sure
j
Not sure if this is what you mean (line 40)
r
Make the function async
j
yep
Do I need to have the preAPI and post APi hooks?
r
you don't need to add any of these if you don't need to add anything in them
j
super
Do I need to update the core docker image that I am hosting?
I got stuck in an infinite loop now, after a user has verified his email
the page just keeps refreshing
I think it is the SessionAuth that is causing it
r
> Do I need to update the core docker image that I am hosting? If the backend SDK doesn't complain about it, you don't. > I think it is the SessionAuth that is causing it Hmm. Could be a lot of reasons. Would need more details
j
I just saw in the changelog that there had been an issue with it refreshing in loop
r
Hmmmm
j
do you have time to look at it with me?
r
Not today or tomorrow. But day after, yea
j
Alright 😄
r
I suggest that you have a look at the quick setup docs again and see if there is something there that you haven’t done. Since I think the version of the SDK you used was pretty old
j
yeah, thats what i'm doing. I think the problem is that I do not redirect after login now.
But I'm a bit confused by the fact that the
r
Hmm. Well. It should redirect to / by default then
j
/ is where the login happens
Thats where I have my login component
r
Ah ok. So then yea. You need to redirect to some other location
j
I'm a bit confused as to why the action can only be the string "VERIFY_EMAIL"
and does that mean that it went well, or that it is supposed to happen?
r
Oh. Is that in there email verification recipe?
j
/playerpage is where I want to redirect to
yes it is
Copy code
recipeList: [
    EmailVerification.init({
      mode: "REQUIRED",
      // Props from emailVerificationFeature of the EmailPassword.init config should be moved here.

      getRedirectionURL: async (context) => {
        if (context.action === "VERIFY_EMAIL") {
          return "/playerpage";
        } else {
          if (context.action === "SUCCESS") {
            return "/playerpage" //TODO add course select page here
          }
        }
        return undefined;
        // Move handling email verification related redirects here
      },
`
r
Ah. So VERIFY_EMAIL means that it’s asking you where to redirect to verify the email.
The SUCCESS state still goes in the other recipe
Emailpassword for example
j
ahhh okay, I removed it from the emailpassword recipe
that context.action no longer has a SIGN_IN_AND_UP string though
r
Yea. That’s moved to a top level function for redirection which gets TO_AUTH (I think)
It should be mentioned in the Changelog
j
yeah i saw something about it
My issue is resolved now. The reason was that I kept redirecting
because I had removed the redirect from the emailPassword recipe
r
Yea fair!
j
I think I'm good to go now, thanks again for your help!