Back

[Solved] Can't use custom domain for email verification url

  • 0
  • General
  • Flutter
Ernest
10 Jun, 2023, 16:03

So I just need to add a web platform with the desired domain even though the apps won't be supported on the web. Thanks, I'll try it out.

TL;DR
The user wants to use custom domains for email verification URLs in Appwrite, but is having trouble. Another user suggests adding web platforms with the desired domains in the project settings. The issue is resolved by adding a web platform with the desired domain, even if the app is not supported on the web.
Chola
10 Jun, 2023, 17:32

We must be talking about different things, I mean the Custom Domain from Settings, not the platform

Drake
10 Jun, 2023, 18:27

Right. Custom domain isn't related to this problem

Chola
11 Jun, 2023, 08:44

@Ernest you want an email verification to come from https//appwrite.app1.tld and from https//appwrite.app2.tld? Looks like you might need separate appwrite cloud instances

Ernest
11 Jun, 2023, 08:48

That's what I wanted clarification on. And I think @Steven answered it somewhat. I think it would be helpful to have different urls for email verification for different projects.

Ernest
11 Jun, 2023, 08:50

Having multiple appwrite instances just so I can tailor the email verification url for different projects is not ideal

Chola
11 Jun, 2023, 09:17

I see your point, with one Appwrite instance we are able to host multiple projects ,but doesn't each project have the ability to use a different custom domain and a different hostname? I think they do

Drake
11 Jun, 2023, 15:29

What do you mean different urls?

Drake
11 Jun, 2023, 15:29

What do you mean? Emails don't come from a url 🧐

Ernest
11 Jun, 2023, 15:34

For the flutter sdk to create an email confirmation this is how it's documented:

TypeScript
  Future result = account.createVerification(
    url: 'https://example.com',
  );
Ernest
11 Jun, 2023, 15:36

The method requires a url and I want to pass different urls to that method for apps in different projects

Ernest
11 Jun, 2023, 15:37

But for now it requires that the url domain be either localhost or domain.set.in.env

Ernest
11 Jun, 2023, 15:42

So say I have two projects (fitness app project & ride hailing app project). I want to be able to pass as an example:

Fitness app

TypeScript
Future result = account.createVerification(
    url: 'https:// fitness.app',
  );

and for ride hailing app

TypeScript
Future result = account.createVerification(
    url: 'https:// awesomeride.com',
  );

That's basically all I want to do

Ernest
11 Jun, 2023, 15:47

Also, when a verification email is sent; the userID and token for verification are appended to the passed in url and sent to the user's inbox. I don't want users' of both apps seeing the verification url as https://domain.set.in.env? userId=xxxx&token=yyyyyyyy

Ernest
11 Jun, 2023, 15:48

@Steven I know the thread is getting long but if you could provide any insight or clarification that'll be super helpful.

Chola
11 Jun, 2023, 17:16

@Ernest the domain that your app is sitting on is the one that goes into createVerification(), so if you put in a custom domain in your Appwrite project, say https://fitness.app (you have to have access to https://fitness.app) then you can make your verification endpoint to be https://fitness.app/verify. Obviously the /verify route should be one that exists in your app and can handle your incoming verification request.

Ernest
11 Jun, 2023, 17:19

Tried that; didn't work. Got an error saying to use either localhost or domain.set.in.env. Maybe I'm doing something wrong though

Chola
11 Jun, 2023, 17:48

I'm using cloud Appwrite for now, I guess the Appwrite team will advise better on the .env thing. For me I setup the host in the projects "Platforms" settings, under update hostname. That worked for me

Drake
11 Jun, 2023, 17:52

It might be confusing when you say custom domain because that's something else in the Appwrite Console.

Drake
11 Jun, 2023, 17:52

Right, so you'll need to add web platforms for those hostnames

Drake
11 Jun, 2023, 17:53

The url in the email will be whatever url you out when you call the create verification method.

Ernest
11 Jun, 2023, 17:55

Hence the confusion, I thought custom domains were the way to go since it allows the appwrite instance to be accessed using the custom domain set.

Ernest
11 Jun, 2023, 17:56

Great thanks for clearing that up. I'll be trying it later. Thanks @Steven @Chola

Ernest
11 Jun, 2023, 20:57

[Solved]Can't use custom domain for email verification url

Ernest
11 Jun, 2023, 20:57

[Solved] Can't use custom domain for email verification url

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