Back

Why verification link is not going after deployment?

  • 0
  • Web
Arti Gaund
28 Oct, 2023, 09:13

After deploying website on versel, the verification link is not going. Verification link has not been sended AppwriteException: Invalid url param: URL host must be one of: localhost, cloud.appwrite.io, *.vercel.app at pR.<anonymous> (https://persona-blog-kohl.vercel.app/assets/index-4ca92157.js:109:168409) at Generator.next (<anonymous>) at l (https://persona-blog-kohl.vercel.app/assets/index-4ca92157.js:109:162164) I have added the platform in appwrite, even changed the url link for email verification.

TL;DR
The user is experiencing an issue with the verification link not being sent after deploying their website on Vercel. They are using the Appwrite API for email verification and have added the platform in Appwrite. However, they are receiving an error stating that the URL host must be one of: localhost, cloud.appwrite.io, *.vercel.app. Solution: The user needs to ensure that the URL they are using for email verification matches one of the specified hosts. They should check their code and make sure the URL matches the correct hostname.
Arti Gaund
28 Oct, 2023, 09:14
TypeScript
        // const url = "http://localhost:5173/all-posts"
        const url = "*.vercel.app/all-posts"
        return await this.account.createVerification(url).then((response) => {
            toast.info("Verification link has been send to your email, please verify your account by clicking on it!",{
                position: toast.POSITION.TOP_RIGHT
            })
            console.log("Verification link has been sended to your email, please verify your account ",response);
        })
        .catch((error) => {
            console.log("Verification link has not been sended ",error);
            toast.error("Failed to send verification link. ")
        })
    }
    async confirmEmailVerification({ userId, secret }){
        return await this.account.updateVerification( userId, secret ).then((response) => {
            console.log("Account verified successfully");
        })
        .catch((error) => {
            console.log("Error occurred during email verification: ", error)
        })
    }```
Arti Gaund
28 Oct, 2023, 09:14
TypeScript
        // const url = 'http://localhost:5173/recovery'
        const url = '*.vercel.app/recovery'
        return await this.account.createRecovery(email, url)
        .then((response) => {
            toast.success("Password recovery link has been sended to your mail, please check it! ",{
                position: toast.POSITION.TOP_RIGHT
            })
            console.log("Recovery link has been sended to your mail check it, ",response)
        })
        .catch((error) => {
            toast.error("Error in sending recovery link", {
                position: toast.POSITION.TOP_RIGHT
            })
            console.log("Error in sending link ",error)
        })
    }
    async confirmPasswordRecovery({ userId, secret, new_password, confirm_password }){
        return await this.account.updateRecovery( userId, secret, new_password, confirm_password)
        .then((response) => {
            toast.success("Password has been updated successfully. Try login again", {
                position: toast.POSITION.TOP_RIGHT
            });
        })
        .catch((error) => {
            console.log("Error in password confirmation ",error);
            toast.error("Error in password confirmation", {
                position: toast.POSITION.TOP_RIGHT
            })
        })
    }```
Drake
28 Oct, 2023, 15:39

I don't think wildcard for platform works. Try adding a web platform that matches exact hostname

Arti Gaund
28 Oct, 2023, 16:36

I have added a web platform for *vercel in appwrite console.

Drake
28 Oct, 2023, 16:38

I don't think wildcard for platform works. Try adding a web platform that matches exact hostname

Arti Gaund
28 Oct, 2023, 16:45

only vercel.app?

Arti Gaund
28 Oct, 2023, 16:47

bz it don't accept the path.

Drake
28 Oct, 2023, 16:49

No the full hostname/domain

Arti Gaund
28 Oct, 2023, 16:56

its showing cors error now

Drake
28 Oct, 2023, 16:59

That is not the full hostname/domain ..

Arti Gaund
28 Oct, 2023, 19:30

by going on url its showing 404 but i have page in all-posts

Drake
28 Oct, 2023, 22:08

Is your code deployed to that url?

Arti Gaund
29 Oct, 2023, 09:29

Its working now.

Arti Gaund
29 Oct, 2023, 10:34

Is there no function to delete the account of user. this.account.delete() its not the function to delete the user account?

Drake
29 Oct, 2023, 14:53

You would use https://appwrite.io/docs/references/cloud/client-web/account#updateStatus. Then, you need something to delete the user and anything else that may be necessary (their documents)

Arti Gaund
29 Oct, 2023, 16:38

By updateStatus userAccount is block, then the that user cannot make an account by using those details. As in this document, using user API https://appwrite.io/docs/references/cloud/server-nodejs/users user can be deleted by appwrite doesn't provide Users as an exports.

Drake
29 Oct, 2023, 16:39

Sorry I don't understand

Arti Gaund
29 Oct, 2023, 16:42

As you said to use updateStatus, but updateStatus block the user, it didn't delete the user account.

Arti Gaund
29 Oct, 2023, 16:42

In documentation its given we can delete the user account using user API.

Arti Gaund
29 Oct, 2023, 16:43

but user API are for node.js not for web.

Drake
29 Oct, 2023, 17:14

Yes, correct, because you need to handle the delete server side making sure to delete whatever else that's needed

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more