Hey 🙂 Trying to implement email verification (op...
# support-questions-legacy
c
Hey 🙂 Trying to implement email verification (optional, default email service); I installed the recipe like so in recipesList :
Copy code
ts
          EmailVerification.init({
            mode: 'OPTIONAL',
            override: {
              apis: (originalImplementation) => {
                return {
                  ...originalImplementation,
                  generateEmailVerifyTokenPOST: (input) => {
                    console.log(input)
                    return originalImplementation.generateEmailVerifyTokenPOST!(
                      input,
                    )
                  },
                  isEmailVerifiedGET: (input) => {
                    console.log(input)
                    return originalImplementation.isEmailVerifiedGET!(input)
                  },
                  verifyEmailPOST: (input) => {
                    console.log(input)
                    return originalImplementation.verifyEmailPOST!(input)
                  },
                }
              },
            },
          }),
(just logs to watch the behavior) Uppon signup, I'm not receiving any emails; and not seeing any logs. Am I missing something ? NB: worth mentionning I'm using a "hook" in signup to insert a record in my own Database. It calls the originalImplementation too NB2: worth mentionning I'm not using any frontend for now, and just calling my signup "proxy" from Postman
Looking into logs, I'm seeing the recipe called on the core : > mtn-supertokens-supertokens-1 | 26 Apr 2023 13:53:01:889 +0000 | INFO | pid: ebf84671-5799-48a8-b4d9-d4349eced285 | [http-nio-0.0.0.0-3567-exec-9] thread | io.supertokens.webserver.WebserverAPI.service(WebserverAPI.java:192) | API ended: /recipe/user/email/verify. Method: GET
--------- I tried with SMTP, and I can reproduce the exact same behavior
r
Hey. The email verification API is called from the frontend post sign up - is the frontend calling the API?
And with optional mode, the frontend doesn't call it by default - you have to call it yourself, whenever you want the user to do email verification.
c
Thanks. I'll give it a shot and implement it in the signup itself. I found the way to generate a link; but I'm looking for a way to actually generate the frontend URL. I found somewhere in the docs :
Copy code
ts
`${websiteDomain}${websiteBasePath}/verify-email`
Can you confirm there is not any other convenient way to generate it ?
r
there is no other way to generate the link at the moment.
i mean you can call the email verification API from the frontend and that would generate a link.
but if you want to manually generate a link, then that's the only way
c
Alright thanks 🙂
Nota bene then : A simple helper method like
generateFrontendURL('/path')
could be cool; reading supertokens-node there are some semi-clever things done to clean URLs. In my case I'd like to do the similar to align; and thus will have to re-do this in my code (extra
/
pruning, etc.)
r
that makes sense. We just haven't had the bandwidth to do this at the moment.
4 Views