How to achieve Dynamic Credentials.json (in production)

Hi All,
Greetings for the day.
I have a query about the credentials.json file of a Connect App. We are about to make our app live to our client and we are facing issues with the credentials.json file. The credentials.json file contains the user domain, email and api token with which the add-on is installed on the user’s domain.
My question is how to make this file dynamic? I mean how to get the domain, user email and api token (or any other alternative) dynamically?
Or is there any way to use the app without the credentials.json file?

Please help me with my query. Thanks in advance.

Hi @SaaketGupta,

There is no need to make the file dynamic as the details are not required when installing the app in a customer site. The Atlassian product will take care of the installation on the selected site and no credentials are needed (the user installing the app will need to be logged in).

When distributing the app to the customer, the customer will upload the app from the product UI directly (see this page) using the baseUrl of the app that your team will provide.

In the same way, if the app is distributed on the Marketplace no credentials.json file is required. The instructions for app developers on how to distribute an app in this way are available here.

I also wrote this some time ago recommending to never commit this file: Use of credentials.json file in a Connect app - #2 by ccurti

Cheers,
Caterina

Thank you @ccurti for your response.
I understood that I don’t need the credentials file on my server. I researched a bit and had done some changes listed below:

  1. Defined the baseUrl and localbaseurl in my atlassian-connect.json and config.json respectively.
  2. Declared node_env as production.

Do I need to do something else? I wasn’t able to understand this part of your response: “the customer will upload the app from the product UI directly using the baseUrl of the app that your team will provide.”
Could you please provide me some more insights? I would really appreciate it :slight_smile:

Hi @SaaketGupta,

I would say that’s what’s needed at the minimum. When moving from a development app to a production app there are other considerations like the ones mentioned here.

If the app stores data outside of the Atlassian product, have a look at the store tag in the ACE repository.

About the app installation, you’ll need to understand if the app will be installed by a single customer or if there is the potential for other customers to use it in the future. If more customers might use it in the future, the community opinion (see this thread) is that it’s better to list it in the Marketplace (a private listing is an option).

What I meant with my sentence is that, if the app is not available on the Marketplace, the customer will need to install the app in a similar way as you can install it manually on a test site:

  • browse to the /plugins/servlet/upm URL
  • select “Upload app” (this option is only available if the Settings → Enable development mode has been selected - here are the detailed instructions with screenshots)

Caterina