#Send appwrite function url as url redirect url param for creating magic url session
32 messages · Page 1 of 1 (latest)
Are you using Cloud?
Yes
Are you using a custom domain at all?
No.. I have created an appwrite function.. I want to send the function url in the url param of createmagicurlsession
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
You're not able to as you don't own that domain name
Exactly
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
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
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
Let us explore how to set up password less, Magic URL based authentication in your Flutter app using Appwrite. We'll also explore how to setup Android and iOS apps to handle the redirect URL so that you will not have to host a web app just for this purpose.
I can do that but I want to allow my users to let their friends also sign in to their account without sharing password
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
With 1.5, you could either implement a email OTP login or if that won't work then a custom token login would sort it
Yeah, I think 1.5 would have email OTP option? That would solve my issue
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
Release date?
There's isn't an announced release date yet I'm afraid but they've said it'll be soon
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
Which list of custom domains are you look at?
It's now showing in settings > custom domains
But how can I invoke appwrite function through the custom domain?
Even after adding custom domain, createmagicurlsession is not accepting the custom domain in the url param
What is the domain you added? And has it been verified?