Hi, thank you for an amazing work! I've use the Passwordless recipe with Ionic app and developer/user experience was amazing.
Now I'm trying to figure out, if it is possible to use a single API and 2 frontend with different domain names? In my case ionic use localhost in hybrid app, but to publish it on the web I need another registered domain name.
r
rp_st
12/28/2022, 3:07 PM
Hey @th1nkk1d you can use env vars to determine if it’s local dev or not. And if it is, set websiteDomain to localhost
rp_st
12/28/2022, 3:08 PM
Is this what you were asking? Maybe I’m misunderstanding.
t
th1nkk1d
12/28/2022, 3:25 PM
Hi, ionic will use "localhost" for prod too (it will be served inside native app). That means in my case, I'll have
- nodejs api with domain api.somedomain
- ionic app with domain localhost
- web app with domain app.somedomain
All at the same time in a production environment. Not sure if it's possible to use single api for both front-end in this case.
r
rp_st
12/28/2022, 3:30 PM
Ahh right.
rp_st
12/28/2022, 3:31 PM
So this can be done. You should set the websiteDomain on the backend to point to your web app’s domain and also set cookieSameSite in session.init on the backend to have value of “none”
rp_st
12/28/2022, 3:32 PM
This means things like passwordless links will open in the web app. If you want it to open in ionic app for requests from ionic, then you should override the sendEmail function in emailDelivery config and change the domain in the magic link based on the request’s origin.