I need some clarification on how the redirect url ...
# help
d
I need some clarification on how the redirect url works with creating an account. 1. User creates an account and they get an email to confirm. 2. They can click the anywhere there is an email client. My understanding is that I should create a deep link in my app to handle this and I can then create a custom schema. But what happens if the user then clicks the link on a computer?
s
The link points towards the auth part of your Supabase project. It checks the parameters in the URL and marks the account as activated in the DB. Once that's complete, it redirects to the URL you specify (if it's in the allow list) If the user clicks the link on a device where your app isn't installed, their account will be activated still. If you're redirecting them to a web location which would open the app if it was installed, the redirection would happen but then the user would remain on the page you initially redirected them to
If you're trying to direct to an app-scheme URL (e.g.
my-app://some/deep/link
), then the users account will be activated, but the redirect location wouldn't be valid on any device where the app isn't installed so they'll remain on a blank webpage
d
Hmm okay that makes sense but I'm like 65% understanding. When they click the link the email, Supabase will activate the account. They will then get sent to whatever is in my
Site URL
? Where/How do the
Additional Redirect URLs
work?
I guess the end goal is that when clicking the email link in a location where there is no app, that it'll get sent to a website I own where I can write something. But if the app exists, I want the deep link. Does that make any sense?
s
Yeah, that makes sense. In your situation, you'll probably want to make use of universal links (iOS: https://developer.apple.com/ios/universal-links/ , Android: https://developer.android.com/training/app-links) For example, if you're using something like Expo in React Native, you'd use the instructions at https://docs.expo.dev/guides/linking/#universaldeep-links-without-a-custom-scheme If the app is installed, the app will handle the link even if it's
http://my-website.com/login-callback
. If the app isn't installed, then the user would end up in the browser at that URL so whatever is on the page will be shown in the browser. You could have that URL redirect to the home page - since that'll only trigger in the browser, your app users would have the experience handled in the app instead.
Additional redirect URL's are an allow list - if you try to redirect to
bad-domain.com
and you only have
good-domain.com
in the list, the redirect URL will be
good-domain.com
. You can redirect to any URL in the additional URL's list.
d
Oof whenever I read about universal links they sound like a pain to do correctly. Am I correct then that the people who do not use universal links are okay with their users going to a blank page on different devices?
s
I've only tried to set them up once, but ultimately I ended up just using the app scheme (e.g.
my-app://deep-link
) as my redirect because I couldn't get universal links working as I expected. If I had a web-version of the app, then I'd want to use universal links instead, but I'm OK with users being on a blank page if they choose to follow the link on a different device where the app isn't installed. It's not ideal, but it's also not the end of the world.
d
Yeah that's fair. Seems like something I shouldn't worry about until it actually becomes a problem
Thank you so much for helping explain this to me