Using custom domain to call multiple apps from a landing page

What I’m trying to do:
I have created a subdomain of the form portal.mydomain.uk. I have a landing app which handles log in (using Anvil User Services) and then presents a menu to the user, the menu being tailored depending on who the user is. I have published the landing app to portal.mydomain.uk and can access it successfully using the published URL. Each menu item then calls an app which has been published to a private link in Anvil (anvil.app).

What I’ve tried and what’s not working:
The links from the landing app work in that they take me to the login form of the app I am calling but although I have ticked the ‘Share login status with other apps’ and ‘Remember login between sessions’ boxes in User Services SSO is not working - I get the ‘You are not logged in’ message and prompted to log in again. When I had all the apps published to private links in Anvil SSO worked fine.

I did notice that the https has been crossed out in red with the ‘Not secure’ message in the navigation bar. I assume this is because Anvil has yet to sort out the SSL. Would that prevent SSO working or is there another explanation? Anyone have any ideas please?
Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 

Clone link:
share a copy of your app

You also need to share the user table.

When you add the user service to an app, you get a new user table. You need to delete that table and add/share the same user table to every app.

1 Like

Hi Stefano,

I already did that. I know they share the same table because when I add a user in one app I can see it immediately in the other apps.

Regards
Steve

I have a similar setup and it works. The only difference is that all my apps are subdomains of the same company domain, I don’t use the private links. I don’t know if that makes any difference with the user login.

I have a portal.mydomain.uk and a bunch of this.app.mydomain.uk and that.app.mydomain.uk.
The app subdomain was suggested by Anvil staff long time ago to make it easier for me to add new subdomains, because adding a new sub-domain required more manual steps and more time compared to adding a new sub-sub-domain. I don’t know if this is still the case, but that’s how I still organize my new apps.

Thank you Stefano for your help.

I am trying to understand what it is that I need to do and my ignorance of how sub domains and sub sub domains work is part of the problem. This is my understanding now of how to implement your solution in my environment: -

I have set up a sub domain of domain myapp.uk called portal.myapp.uk. I publish my portal app to this sub domain. The portal app calls 2 other apps, let’s call them app1 and app2.

So to replicate your set up I should create 2 new sub domains called: -
app1.myapp.uk
app2.myapp.uk

and then publish app1 and app2 to these sub domains respectively.

Is that correct?

Thanks and regards
Steve

I know very little about domain and subdomain setup.

I only know that one day the Anvil staff told me that it would be faster for me to setup new apps if they did half of the setup on the app sub-domain, so when I create a new app on its sub-sub-domain it would be faster.

I don’t know if this is still the case, and I don’t know if that’s your problem with user sign in. I mentioned it only because the setup you described is very similar to my setup, and my shared login works.

Thanks Stefano. All useful information. I shall go ahead and experiment with what I suggested in my last reply to you. I will let you know how I get on!

Regards
Steve