#Send appwrite function url as url redirect url param for creating magic url session

32 messages · Page 1 of 1 (latest)

severe finch
#

I would like to send appwrite function url as url redirect param for creating magic url session.

The error I am getting is "URL host must be one of: localhost, cloud.appwrite.io, appwrite.io

Appwrite function url is like
*.appwrite.global

keen patio
#

Are you using Cloud?

severe finch
#

Yes

keen patio
#

Are you using a custom domain at all?

severe finch
#

No.. I have created an appwrite function.. I want to send the function url in the url param of createmagicurlsession

keen patio
#

It looks like the only way to do what you want would be to use a custom domain name with Appwrite Cloud. You'd be able to set the custom domain as a hostname in your project which should allow you to provide it as a URL for the magic URL session

severe finch
#

But how can I set *.appwrite.global as a custom domain

#

?

keen patio
#

You're not able to as you don't own that domain name

severe finch
#

Exactly

keen patio
#

You'd need to set the custom domain to one that you'd own and then get the URL of the function after as it should provide a URL for the function using your custom domain. Other than that, you won't be able to do what you're wanting to due to security reasons

#

Otherwise, anyone would be able to link to any function on Cloud and that would result in a lot of abuse of the platform

severe finch
#

Let me tell you what I'm trying to achieve so maybe you can suggest an alternate solution

#

I have a react native app.. User puts email in the email field and clicks submit. I create magic url session with this email. Now on clicking the magic url in the email, the secret needs to be stored in a db collection. And now on the client side, I keep querying for the secret in the db every 5 seconds. As soon as the secret is found, update magic url session will be called

keen patio
#

Have you looked into potentially using deep links to capture certain URLs and open them in your app?

#

This is an approach that was used for handling this issue in Flutter but I'm sure a lot of it will also apply for React Native https://www.appwriters.dev/blog/flutter-password-less-authentication-with-appwrite-magic-url

severe finch
keen patio
#

The best I can suggest would be to wait for 1.5 to come to Cloud as there looks to be methods to help achieve what you're looking for. The deep linking would usually be the solution here but wanting to allow account sharing introduces more complexity

severe finch
#

Yeah, I think 1.5 would have email OTP option? That would solve my issue

keen patio
#

Yeah, that's what I was thinking as well. Until 1.5 comes out on Cloud, I'm not sure there are any options that would allow for the account sharing

severe finch
#

Release date?

keen patio
#

There's isn't an announced release date yet I'm afraid but they've said it'll be soon

severe finch
#

Cool.. Until then, I'll look into the custom domain approach

#

I added a custom domain but it's not showing in the list of custom domains

keen patio
#

Which list of custom domains are you look at?

severe finch
#

It's now showing in settings > custom domains

#

But how can I invoke appwrite function through the custom domain?

severe finch
#

Even after adding custom domain, createmagicurlsession is not accepting the custom domain in the url param

keen patio
#

What is the domain you added? And has it been verified?

severe finch
#

Yes, it's verified

#

Still getting this error