I share this because it took me some time to figure out how I could connect 2 apps to the same backend code on my server. I had build one app with several integrations and was looking for a way to split these features so that every feature is part of its own app. But also wanted the “old” sithuation (one app / multiple features) to work.
On the backend I did not want to copy/paste code so the requirement was that APP1 (with feature XYZ) could use exactly the same code as APP2 (with the same feature XYZ). Off course APP1 and APP2 had different signing secrets and client ids. Not to hard to decide in code which client ids, client secrets and signing secrets you need to use. The hard part is to know (in your backend) which app sends the request to your server. There is no such thing as an appId (yet).
So, I thought, let’s make use of a “appCode” and put it in the run URL path (and off course the (un)subcribe paths if you are using custom triggers). Now we can distinguish between APP1 and APP2 but they are both pointing to different endpoints (because the appCode is in the path).
Let’s configure nginx to solve that for us and at the same time put the appCode in the request header. So now every request has the appCode in its header. The nginx config looks like this (screenshot from my Plesk server):
What is does is that it proxies passes https://mondayapps.excellent-team.nl/VTG/path/to/backend to https://mondayapps.excellent-team.nl/path/to/backend and at the same time sets a header (MondayApp) to VTG. The same /path/to/backend can be used in another app (in my case the generic app that has APP as the appCode). In your backend you expose just one endpoint for both apps and the code checks the req.header.mondayapps value to make sure it uses the correct app client id, secret and signing secret.
Have fun with it.