https://supertokens.com/ logo
Title
j

JacobLUC

10/09/2022, 3:15 PM
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:
Argument of type '{ mode: string; }' is not assignable to parameter of type 'TypeInput'.
r

rp

10/09/2022, 3:16 PM
Hey
j

JacobLUC

10/09/2022, 3:16 PM
hey 😄
I'm back with more silly questions 😉
r

rp

10/09/2022, 3:16 PM
What’s the import statement? Also are you using the latest version of the SDKs?
j

JacobLUC

10/09/2022, 3:17 PM
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

rp

10/09/2022, 3:17 PM
Oh yea. New indeed
If you are updating it, I recommend you see the Changelog
j

JacobLUC

10/09/2022, 3:18 PM
do you have. a link?
And also see the front end SDK Changelog
j

JacobLUC

10/09/2022, 3:22 PM
updating got rid of the error
I have some trouble front-end now after updating to 0.26.4
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

rp

10/09/2022, 3:40 PM
You don’t have to update any types. It’s all part of the SDK
j

JacobLUC

10/09/2022, 3:40 PM
alright
i'm trying to follow the migration step found in the changelog
r

rp

10/09/2022, 3:40 PM
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

JacobLUC

10/09/2022, 3:41 PM
Not sure if this is what you mean (line 40)
r

rp

10/09/2022, 3:42 PM
Make the function async
j

JacobLUC

10/09/2022, 3:42 PM
yep
Do I need to have the preAPI and post APi hooks?
r

rp

10/09/2022, 3:43 PM
you don't need to add any of these if you don't need to add anything in them
j

JacobLUC

10/09/2022, 3:43 PM
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

rp

10/09/2022, 4:59 PM
> 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

JacobLUC

10/09/2022, 5:04 PM
I just saw in the changelog that there had been an issue with it refreshing in loop
r

rp

10/09/2022, 5:05 PM
Hmmmm
j

JacobLUC

10/09/2022, 5:10 PM
do you have time to look at it with me?
r

rp

10/09/2022, 5:10 PM
Not today or tomorrow. But day after, yea
j

JacobLUC

10/09/2022, 5:11 PM
Alright 😄
r

rp

10/09/2022, 5:21 PM
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

JacobLUC

10/09/2022, 5:22 PM
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

rp

10/09/2022, 5:22 PM
Hmm. Well. It should redirect to / by default then
j

JacobLUC

10/09/2022, 5:23 PM
/ is where the login happens
Thats where I have my login component
r

rp

10/09/2022, 5:23 PM
Ah ok. So then yea. You need to redirect to some other location
j

JacobLUC

10/09/2022, 5:23 PM
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

rp

10/09/2022, 5:24 PM
Oh. Is that in there email verification recipe?
j

JacobLUC

10/09/2022, 5:24 PM
/playerpage is where I want to redirect to
yes it is
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

rp

10/09/2022, 5:24 PM
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

JacobLUC

10/09/2022, 5:25 PM
ahhh okay, I removed it from the emailpassword recipe
that context.action no longer has a SIGN_IN_AND_UP string though
r

rp

10/09/2022, 5:27 PM
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

JacobLUC

10/09/2022, 5:27 PM
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

rp

10/09/2022, 5:28 PM
Yea fair!
j

JacobLUC

10/09/2022, 5:29 PM
I think I'm good to go now, thanks again for your help!