I have a multi-tenant application that I am integrating to Jira and BitBucket using Atlassian Connect.
When a customer needs to integrate Jira/Bitbucket with my app, I ask them to install my Atlassian Connect Apps for these (currently in private beta so its a private installation via URL).
Each customer will end up installing my AC app on their server (for Jira) or under their account for (BitBucket cloud). So I will have multiple records in my database for these different installations of the app.
Now I need to be able to figure how to connect the installation that a particular customer makes to
that customer’s account information in my app. So for example, if I pull issues from a project in JIra from a particular customer’s installation, then I need to make sure they are associated with that customer’s account in my app.
Is there standard, supported way of doing this? The client_key from atlassian connect clearly distinguishes the different installations in my database, but it does not seem to be visible or exposed in the installed apps descriptor in the customer’s installation. If this was visible then I could have my customers do a post-install step to enter this client key and look it up to connect the AC connector with the customer’s account on my side.
Right now I am resorting to what seems like hacks to solve this problem. For Jira I look up the baseUrl of the server it is installed on to identify the connector instance with the account (the user has to type this in anyway while setting up the JIRA integration. On JIRA this works because each customer usually has a separate URL. But on BitBucket Cloud this does not work since all the baseUrls are the same. I noticed in this case that the client key is is constructed from the uuid of the user under whose account the app is installed and the app’s add-on key so I could possibly have the user provide the uuid to identify the connector. It all works, but this seems really fragile and ad hoc to me.
So it seems like I am missing something fundamental since this seems like a pretty common problem that anyone making a multi-tenant to multi-tenant integration with AC will face.
Does anyone know of recommended technique that can solve this in a more robust error-proof way?